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
SecKey
from data.Throws
An
RSAError
if an error occurs.Declaration
Swift
public static func make(from data: Data, isPublicKey: Bool) throws -> SecKey
Parameters
data
The data used to create the key.
isPublicKey
A Boolean value indicating the key is public or private.
Return Value
The
SecKey
object or nil if data is incorrect. -
Creates
SecKey
from PEM text. The method also trims header data (generated by OpenSSL and others) from PEM if needed.Throws
An
RSAError
if an error occurs.Declaration
Swift
public static func make(fromPEM pem: String, isPublicKey: Bool) throws -> SecKey
Parameters
pem
The string in PEM format.
isPublicKey
A Boolean value indicating the key is public or private.
Return Value
The
SecKey
object or nil if PEM text is incorrect.