IdentityHelper
public class IdentityHelper
Helper for converting SecIdentity to PKCS #12 Data and vice versa
-
Singleton - provides a globally accessible, shared instance of this object
Declaration
Swift
public internal(set) static var shared: IdentityHelper { get } -
Default passphrase to encode the user identity
Declaration
Swift
public static let passphrase: String -
Converts
SecIdentityto PKCS #12DataDeclaration
Swift
public func pkcs12Data(fromIdentity identity: SecIdentity, passphrase: String = passphrase) throws -> DataParameters
identitySecIdentityReturn Value
Datawith PKCS #12 content -
Converts PKCS #12
DatatoSecIdentityThe method uses only the first identity item from the data
Declaration
Swift
public func identity(fromPKCS12Data pkcs12Data: Data, passphrase: String = passphrase) throws -> (identity: SecIdentity, certificates: [SecCertificate]?)Parameters
pkcs12DataPKCS #12
DatapassphraseStringto open the PKCS #12DataReturn Value
SecIdentitythat was stored in the PKCS #12Data -
Converts PKCS #12
DatatoURLCredentialThrows
IdentityError.failedToCreateIdentity if the PKCS #12 import failedDeclaration
Swift
public func urlCredentialFromIdentity(identityData: Data, passphrase: String = passphrase) throws -> URLCredentialParameters
identityDataDatathat contains the identitypassphraseStringto import the PKCS #12 dataReturn Value
URLCredentialwith the identity and the certificate CAs