File tree Expand file tree Collapse file tree 3 files changed +17
-26
lines changed Expand file tree Collapse file tree 3 files changed +17
-26
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ arduino::MbedSSLSE050Client::MbedSSLSE050Client() {
2626void arduino::MbedSSLSE050Client::setEccSlot (int KeySlot, const byte cert[], int certLen) {
2727
2828 _keySlot = KeySlot;
29- _client_cert_len = certLen;
30- _client_cert = cert;
29+ _certLen = certLen;
30+ _cert = cert;
3131}
3232
3333void WiFiSSLSE050Client::setEccSlot (int KeySlot, const byte cert[], int certLen) {
Original file line number Diff line number Diff line change @@ -37,37 +37,28 @@ class MbedSSLSE050Client : public arduino::MbedSSLClient {
3737 void setEccSlot (int KeySlot, const byte cert[], int certLen);
3838
3939private:
40- const byte* _client_cert;
41- const char * _ca_cert;
42- int _client_cert_len;
40+ const byte* _cert;
41+ int _certLen;
4342 int _keySlot;
4443 sss_object_t _keyObject;
4544
4645 int setRootCAClientCertKey () {
47- if ( NSAPI_ERROR_OK != ((TLSSocket*)sock)->set_root_ca_cert_path (" /wlan/" )) {
48- return 0 ;
46+ int err = setRootCA ();
47+ if (err != NSAPI_ERROR_OK) {
48+ return err;
4949 }
5050
51- if (_hostname && !_disableSNI ) {
52- ((TLSSocket*)sock)-> set_hostname (_hostname) ;
51+ if (SE05X. getObjectHandle (_keySlot, &_keyObject) != NSAPI_ERROR_OK ) {
52+ return NSAPI_ERROR_DEVICE_ERROR ;
5353 }
5454
55- if ( NSAPI_ERROR_OK != ((TLSSocket*)sock)->append_root_ca_cert (_ca_cert_custom)) {
56- return 0 ;
55+ if (((TLSSocket*)sock)->set_client_cert_key ((void *)_cert,
56+ (size_t )_certLen,
57+ &_keyObject,
58+ SE05X.getDeviceCtx ()) != NSAPI_ERROR_OK) {
59+ return NSAPI_ERROR_DEVICE_ERROR;
5760 }
58-
59- if (!SE05X.getObjectHandle (_keySlot, &_keyObject)) {
60- return 0 ;
61- }
62-
63- if ( NSAPI_ERROR_OK != ((TLSSocket*)sock)->set_client_cert_key ((void *)_client_cert,
64- (size_t )_client_cert_len,
65- &_keyObject,
66- SE05X.getDeviceCtx ())) {
67- return 0 ;
68- }
69-
70- return 1 ;
61+ return NSAPI_ERROR_OK;
7162 }
7263};
7364
Original file line number Diff line number Diff line change @@ -63,15 +63,15 @@ class MbedSSLClient : public arduino::MbedClient {
6363 _privateKey = privateKey;
6464 }
6565
66- protected :
66+ private :
6767 const char * _rootCA;
6868 const char * _hostname;
6969 const char * _clientCert;
7070 const char * _privateKey;
7171 bool _disableSNI;
7272 bool _appendCA;
7373
74- private :
74+ protected :
7575 int setRootCA () {
7676 int err = 0 ;
7777
You can’t perform that action at this time.
0 commit comments