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
ClientCertificatefrom an existingNIOSSLCertificateandNIOSSLPrivateKey. 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
certificateThe client certificate.
privateKeyThe private key for the certificate. If the data for the key is encrypted, then an appropriate passphrase callback must be configured.
-
Initialize a
ClientCertificatefrom 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) throwsParameters
pemFileThe fully-qualified filename of the PEM file containing the certificate and private key.
passphraseThe passphrase for the private key, or nil if the key is not encrypted.
-
Initialize a
ClientCertificatefrom aStringin 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) throwsParameters
pemStringA string containing the certificate and private key in PEM format.
passphraseThe passphrase for the private key, or nil if the key is not encrypted.
-
Initialize a
ClientCertificatefromDatain 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) throwsParameters
pemDataThe data containing the certificate and private key in PEM format.
passphraseThe passphrase for the private key, or nil if the key is not encrypted.
-
Initialize a
ClientCertificatefrom 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) throwsParameters
pemBytesThe data containing the certificate and private key in PEM format.
passphraseThe passphrase for the private key, or nil if the key is not encrypted.
View on GitHub
ClientCertificate Structure Reference