ObjFW
Instance Methods | List of all members
<OFTLSSocket> Protocol Reference

A protocol that should be implemented by 3rd-party libraries implementing TLS. More...

#import <ObjFW/OFTLSSocket.h>

Instance Methods

(id) - initWithSocket:
 Initializes the TLS socket with the specified TCP socket as its underlying socket. More...
 
(void) - startTLSWithExpectedHost:
 Initiates the TLS handshake. More...
 
(void) - setDelegate:
 Sets a delegate for the TLS socket. More...
 
(nullable id< OFTLSSocketDelegate >) - delegate
 Returns the delegate used by the TLS socket. More...
 
(void) - setCertificateFile:
 Sets the path to the X.509 certificate file to use. More...
 
(void) - setCertificateFile:forSNIHost:
 Sets the path to the X.509 certificate file to use for the specified SNI host. More...
 
(nullable OFString *) - certificateFile
 Returns the path of the X.509 certificate file used by the TLS socket. More...
 
(nullable OFString *) - certificateFileForSNIHost:
 Returns the path of the X.509 certificate file used by the TLS socket for the specified SNI host. More...
 
(void) - setPrivateKeyFile:
 Sets the path to the PKCS#8 private key file to use. More...
 
(void) - setPrivateKeyFile:forSNIHost:
 Sets the path to the PKCS#8 private key file to use for the specified SNI host. More...
 
(nullable OFString *) - privateKeyFile
 Returns the path of the PKCS#8 private key file used by the TLS socket. More...
 
(nullable OFString *) - privateKeyFileForSNIHost:
 Returns the path of the PKCS#8 private key file used by the TLS socket for the specified SNI host. More...
 
(void) - setPrivateKeyPassphrase:
 Sets the passphrase to decrypt the PKCS#8 private key file. More...
 
(void) - setPrivateKeyPassphrase:forSNIHost:
 Sets the passphrase to decrypt the PKCS#8 private key file for the specified SNI host. More...
 
(nullable const char *) - privateKeyPassphrase
 Returns the passphrase to decrypt the PKCS#8 private key file. More...
 
(nullable const char *) - privateKeyPassphraseForSNIHost:
 Returns the passphrase to decrypt the PKCS#8 private key file for the specified SNI host. More...
 
(void) - setCertificateVerificationEnabled:
 Enable or disable certificate verification. More...
 
(bool) - isCertificateVerificationEnabled
 Returns whether certificate verification is enabled. More...
 

Detailed Description

A protocol that should be implemented by 3rd-party libraries implementing TLS.

Method Documentation

- (nullable OFString*) certificateFile

Returns the path of the X.509 certificate file used by the TLS socket.

Returns
The path of the X.509 certificate file used by the TLS socket
- (nullable OFString*) certificateFileForSNIHost: (OFString *)  SNIHost

Returns the path of the X.509 certificate file used by the TLS socket for the specified SNI host.

Parameters
SNIHostThe SNI host for which the path of the X.509 certificate file should be returned
Returns
The path of the X.509 certificate file used by the TLS socket for the specified SNI host
- (nullable id <OFTLSSocketDelegate>) delegate

Returns the delegate used by the TLS socket.

Returns
The delegate used by the TLS socket
- (id) initWithSocket: (OFTCPSocket *)  socket

Initializes the TLS socket with the specified TCP socket as its underlying socket.

Parameters
socketThe TCP socket to use as underlying socket
- (bool) isCertificateVerificationEnabled

Returns whether certificate verification is enabled.

Returns
Whether certificate verification is enabled
- (nullable OFString*) privateKeyFile

Returns the path of the PKCS#8 private key file used by the TLS socket.

Returns
The path of the PKCS#8 private key file used by the TLS socket
- (nullable OFString*) privateKeyFileForSNIHost: (OFString *)  SNIHost

Returns the path of the PKCS#8 private key file used by the TLS socket for the specified SNI host.

Parameters
SNIHostThe SNI host for which the path of the PKCS#8 private key file should be returned
Returns
The path of the PKCS#8 private key file used by the TLS socket for the specified SNI host
- (nullable const char*) privateKeyPassphrase

Returns the passphrase to decrypt the PKCS#8 private key file.

Warning
You should not copy this to insecure memory which is swappable!
Returns
The passphrase to decrypt the PKCS#8 private key file
- (nullable const char*) privateKeyPassphraseForSNIHost: (OFString *)  SNIHost

Returns the passphrase to decrypt the PKCS#8 private key file for the specified SNI host.

Warning
You should not copy this to insecure memory which is swappable!
Parameters
SNIHostThe SNI host for which the passphrase to decrypt the PKCS#8 private key file should be returned
Returns
The passphrase to decrypt the PKCS#8 private key file for the specified SNI host
- (void) setCertificateFile: (nullable OFString *)  certificateFile

Sets the path to the X.509 certificate file to use.

Parameters
certificateFileThe path to the X.509 certificate file
- (void) setCertificateFile: (OFString *)  certificateFile
forSNIHost: (OFString *)  SNIHost 

Sets the path to the X.509 certificate file to use for the specified SNI host.

Parameters
SNIHostThe SNI host for which the path of the X.509 certificate file should be set
certificateFileThe path to the X.509 certificate file
- (void) setCertificateVerificationEnabled: (bool)  enabled

Enable or disable certificate verification.

The default is enabled.

Parameters
enabledWhether to enable or disable certificate verification
- (void) setDelegate: (nullable id< OFTLSSocketDelegate >)  delegate

Sets a delegate for the TLS socket.

Parameters
delegateThe delegate to use
- (void) setPrivateKeyFile: (nullable OFString *)  privateKeyFile

Sets the path to the PKCS#8 private key file to use.

Parameters
privateKeyFileThe path to the PKCS#8 private key file
- (void) setPrivateKeyFile: (OFString *)  privateKeyFile
forSNIHost: (OFString *)  SNIHost 

Sets the path to the PKCS#8 private key file to use for the specified SNI host.

Parameters
privateKeyFileThe path to the PKCS#8 private key file
SNIHostThe SNI host for which the path to the PKCS#8 private key file should be set
- (void) setPrivateKeyPassphrase: (nullable const char *)  privateKeyPassphrase

Sets the passphrase to decrypt the PKCS#8 private key file.

Warning
You have to ensure that this is in secure memory protected from swapping! This is also the reason why this is not an OFString.
Parameters
privateKeyPassphraseThe passphrase to decrypt the PKCS#8 private key file
- (void) setPrivateKeyPassphrase: (const char *)  privateKeyPassphrase
forSNIHost: (OFString *)  SNIHost 

Sets the passphrase to decrypt the PKCS#8 private key file for the specified SNI host.

Warning
You have to ensure that this is in secure memory protected from swapping! This is also the reason why this is not an OFString.
Parameters
privateKeyPassphraseThe passphrase to decrypt the PKCS#8 private key file for the specified SNI host
SNIHostThe SNI host for which the passphrase to decrypt the PKCS#8 private key file should be set
- (void) startTLSWithExpectedHost: (OFString *)  host

Initiates the TLS handshake.

Note
This is only useful if you used initWithSocket: to start TLS on a TCP socket which is already connected!
Parameters
hostThe host to expect for certificate verification. May be nil if certificate verification is disabled.

The documentation for this protocol was generated from the following file: