SecKey
class SecKey : _CFObject
-
The key’s attributes.
List of available attributes: Security Framework Reference. Attribute Item Keys
Declaration
Swift
public var attributes: [String : Any] { get } -
The data of key.
Declaration
Swift
public var data: Data { get } -
The key in PEM format. Public key’s PEM will also contain header data required for OpenSSL and other applications, but not in the internal iOS representation of the key.
Declaration
Swift
public var pem: String { get }
-
Creates
SecKeyfrom data.Throws
An
RSAErrorif an error occurs.Declaration
Swift
public static func make(from data: Data, isPublicKey: Bool) throws -> SecKeyParameters
dataThe data used to create the key.
isPublicKeyA Boolean value indicating the key is public or private.
Return Value
The
SecKeyobject or nil if data is incorrect. -
Creates
SecKeyfrom PEM text. The method also trims header data (generated by OpenSSL and others) from PEM if needed.Throws
An
RSAErrorif an error occurs.Declaration
Swift
public static func make(fromPEM pem: String, isPublicKey: Bool) throws -> SecKeyParameters
pemThe string in PEM format.
isPublicKeyA Boolean value indicating the key is public or private.
Return Value
The
SecKeyobject or nil if PEM text is incorrect.
View on GitHub
SecKey Extension Reference