Allow initializing with private key and certificate
This commit is contained in:
parent
8c3b57e107
commit
38cd6bd401
2 changed files with 15 additions and 0 deletions
|
@ -39,6 +39,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
- initWithSocket: (OFTCPSocket*)socket;
|
- initWithSocket: (OFTCPSocket*)socket;
|
||||||
|
- initWithSocket: (OFTCPSocket*)socket
|
||||||
|
privateKeyFile: (OFString*)privateKeyFile
|
||||||
|
certificateFile: (OFString*)certificateFile;
|
||||||
/* Change the return type */
|
/* Change the return type */
|
||||||
- (SSLSocket*)accept;
|
- (SSLSocket*)accept;
|
||||||
- (void)setPrivateKeyFile: (OFString*)file;
|
- (void)setPrivateKeyFile: (OFString*)file;
|
||||||
|
|
|
@ -105,10 +105,22 @@ ssl_locking_callback(int mode, int n, const char *file, int line)
|
||||||
}
|
}
|
||||||
|
|
||||||
- initWithSocket: (OFTCPSocket*)socket
|
- initWithSocket: (OFTCPSocket*)socket
|
||||||
|
{
|
||||||
|
return [self initWithSocket: socket
|
||||||
|
privateKeyFile: nil
|
||||||
|
certificateFile: nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- initWithSocket: (OFTCPSocket*)socket
|
||||||
|
privateKeyFile: (OFString*)privateKeyFile_
|
||||||
|
certificateFile: (OFString*)certificateFile_
|
||||||
{
|
{
|
||||||
self = [self init];
|
self = [self init];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
|
privateKeyFile = privateKeyFile_;
|
||||||
|
certificateFile = certificateFile_;
|
||||||
|
|
||||||
sock = dup(socket->sock);
|
sock = dup(socket->sock);
|
||||||
|
|
||||||
if ((ssl = SSL_new(ctx)) == NULL || !SSL_set_fd(ssl, sock)) {
|
if ((ssl = SSL_new(ctx)) == NULL || !SSL_set_fd(ssl, sock)) {
|
||||||
|
|
Reference in a new issue