Use certificate / key in client mode if set.
This commit is contained in:
parent
1137a93d7a
commit
2c6ef4d969
1 changed files with 10 additions and 2 deletions
|
@ -79,7 +79,11 @@ static SSL_CTX *ctx;
|
||||||
|
|
||||||
SSL_set_connect_state(ssl);
|
SSL_set_connect_state(ssl);
|
||||||
|
|
||||||
if (SSL_connect(ssl) != 1) {
|
if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl,
|
||||||
|
[privateKeyFile cString], SSL_FILETYPE_PEM)) ||
|
||||||
|
(certificateFile != nil && !SSL_use_certificate_file(ssl,
|
||||||
|
[certificateFile cString], SSL_FILETYPE_PEM)) ||
|
||||||
|
SSL_connect(ssl) != 1) {
|
||||||
close(sock);
|
close(sock);
|
||||||
sock = INVALID_SOCKET;
|
sock = INVALID_SOCKET;
|
||||||
@throw [OFInitializationFailedException
|
@throw [OFInitializationFailedException
|
||||||
|
@ -122,7 +126,11 @@ static SSL_CTX *ctx;
|
||||||
|
|
||||||
SSL_set_connect_state(ssl);
|
SSL_set_connect_state(ssl);
|
||||||
|
|
||||||
if (SSL_connect(ssl) != 1) {
|
if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl,
|
||||||
|
[privateKeyFile cString], SSL_FILETYPE_PEM)) ||
|
||||||
|
(certificateFile != nil && !SSL_use_certificate_file(ssl,
|
||||||
|
[certificateFile cString], SSL_FILETYPE_PEM)) ||
|
||||||
|
SSL_connect(ssl) != 1) {
|
||||||
[super close];
|
[super close];
|
||||||
@throw [OFConnectionFailedException newWithClass: isa
|
@throw [OFConnectionFailedException newWithClass: isa
|
||||||
socket: self
|
socket: self
|
||||||
|
|
Reference in a new issue