ClientCertificate
public struct ClientCertificate
Represents a client certificate that should be provided as part of a RestRequest. The certificate and its corresponding private key will be read from PEM formatted data. If the private key is encrypted with a passphrase, the passphrase should also be supplied.
-
Undocumented
Declaration
Swift
public let certificate: NIOSSLCertificate
-
Undocumented
Declaration
Swift
public let privateKey: NIOSSLPrivateKey
-
Initialize a
ClientCertificate
from an existingNIOSSLCertificate
andNIOSSLPrivateKey
. Use this method if you need complete control over how the certificate and key data is read in.Declaration
Swift
public init(certificate: NIOSSLCertificate, privateKey: NIOSSLPrivateKey)
Parameters
certificate
The client certificate.
privateKey
The private key for the certificate. If the data for the key is encrypted, then an appropriate passphrase callback must be configured.
-
Initialize a
ClientCertificate
from a file in PEM format. The file should contain both the certificate and its private key. If the key is encrypted, then its passphrase should also be supplied.Throws
If the file is not found, or is not in the expected PEM format.Declaration
Swift
public init(pemFile: String, passphrase: String? = nil) throws
Parameters
pemFile
The fully-qualified filename of the PEM file containing the certificate and private key.
passphrase
The passphrase for the private key, or nil if the key is not encrypted.
-
Initialize a
ClientCertificate
from aString
in PEM format. The string should contain both the certificate and its private key. If the key is encrypted, then its passphrase should also be supplied.Throws
If the string is not in the expected PEM format.Declaration
Swift
public init(pemString: String, passphrase: String? = nil) throws
Parameters
pemString
A string containing the certificate and private key in PEM format.
passphrase
The passphrase for the private key, or nil if the key is not encrypted.
-
Initialize a
ClientCertificate
fromData
in PEM format. The data should contain both the certificate and its private key. If the key is encrypted, then its passphrase should also be supplied.Throws
If the data is not in the expected PEM format.Declaration
Swift
public init(pemData: Data, passphrase: String? = nil) throws
Parameters
pemData
The data containing the certificate and private key in PEM format.
passphrase
The passphrase for the private key, or nil if the key is not encrypted.
-
Initialize a
ClientCertificate
from a[UInt8]
containing PEM format data. The data should contain both the certificate and its private key. If the key is encrypted, then its passphrase should also be supplied.Throws
If the data is not in the expected PEM format.Declaration
Swift
public init(pemBytes: [UInt8], passphrase: String? = nil) throws
Parameters
pemBytes
The data containing the certificate and private key in PEM format.
passphrase
The passphrase for the private key, or nil if the key is not encrypted.