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
SecIdentity
to PKCS #12Data
Declaration
Swift
public func pkcs12Data(fromIdentity identity: SecIdentity, passphrase: String = passphrase) throws -> Data
Parameters
identity
SecIdentity
Return Value
Data
with PKCS #12 content -
Converts PKCS #12
Data
toSecIdentity
The 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
pkcs12Data
PKCS #12
Data
passphrase
String
to open the PKCS #12Data
Return Value
SecIdentity
that was stored in the PKCS #12Data
-
Converts PKCS #12
Data
toURLCredential
Throws
IdentityError.failedToCreateIdentity if the PKCS #12 import failedDeclaration
Swift
public func urlCredentialFromIdentity(identityData: Data, passphrase: String = passphrase) throws -> URLCredential
Parameters
identityData
Data
that contains the identitypassphrase
String
to import the PKCS #12 dataReturn Value
URLCredential
with the identity and the certificate CAs