Certificate
public struct Certificate : Equatable
Certificate for TLS/SSL encrypted connections
A certificate can be loaded from a PKCS12-file or directly as a SecIdentityRef.
-
Initialize a new certificate with the given data protected by the given password. The data has to be in PKCS12 format.
If the certificate cannot be loaded, a TLSError is thrown. For further information, activate the -skdebug flag, which prints further error messages.
Throws
A TLSError indicating that the certificate could not be loaded.
Declaration
Swift
public init(with data:Data, password:String? = nil) throwsParameters
dataData object containing the PKCS12 certificate and key
passwordPassword protecting the the specified PKCS12 certificate. If no password should be used, the password should be nil.
-
Creates a new certificate with the specified SecIdentityRef.
Declaration
Swift
public init(with identity: SecIdentity)Parameters
identityIdentity containing the certificate and private key to use
-
Initialize a new certificate with the data at the given path protected by the given password. The data has to be in PKCS12 format.
If the certificate cannot be loaded, a TLSError is thrown. For further information, activate the -skdebug flag, which prints further error messages.
Throws
A TLSError indicating that the certificate could not be loaded.
Declaration
Swift
public init(contentsOf filePath: String, password: String? = nil) throwsParameters
filePathPath to file containing the PKCS12 certificate and key
passwordPassword protecting the the specified PKCS12 certificate If no password should be used, the password should be nil.
-
Initialize a new certificate with the data at the given path protected by the given password. The data has to be in PKCS12 format.
If the certificate cannot be loaded, a TLSError is thrown. For further information, activate the -skdebug flag, which prints further error messages.
Throws
A TLSError indicating that the certificate could not be loaded.
Declaration
Swift
public init(contentsOf filePath: String, readingOptions: NSData.ReadingOptions, password: String? = nil) throwsParameters
filePathPath to file containing the PKCS12 certificate and key
readingOptionsOptions for reading
passwordPassword protecting the the specified PKCS12 certificate If no password should be used, the password should be nil.
View on GitHub
Certificate Struct Reference