File tree 3 files changed +17
-26
lines changed
3 files changed +17
-26
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ arduino::MbedSSLSE050Client::MbedSSLSE050Client() {
26
26
void arduino::MbedSSLSE050Client::setEccSlot (int KeySlot, const byte cert[], int certLen) {
27
27
28
28
_keySlot = KeySlot;
29
- _client_cert_len = certLen;
30
- _client_cert = cert;
29
+ _certLen = certLen;
30
+ _cert = cert;
31
31
}
32
32
33
33
void 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 {
37
37
void setEccSlot (int KeySlot, const byte cert[], int certLen);
38
38
39
39
private:
40
- const byte* _client_cert;
41
- const char * _ca_cert;
42
- int _client_cert_len;
40
+ const byte* _cert;
41
+ int _certLen;
43
42
int _keySlot;
44
43
sss_object_t _keyObject;
45
44
46
45
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;
49
49
}
50
50
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 ;
53
53
}
54
54
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;
57
60
}
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;
71
62
}
72
63
};
73
64
Original file line number Diff line number Diff line change @@ -63,15 +63,15 @@ class MbedSSLClient : public arduino::MbedClient {
63
63
_privateKey = privateKey;
64
64
}
65
65
66
- protected :
66
+ private :
67
67
const char * _rootCA;
68
68
const char * _hostname;
69
69
const char * _clientCert;
70
70
const char * _privateKey;
71
71
bool _disableSNI;
72
72
bool _appendCA;
73
73
74
- private :
74
+ protected :
75
75
int setRootCA () {
76
76
int err = 0 ;
77
77
You can’t perform that action at this time.
0 commit comments