PrivateKeyContainer

public struct PrivateKeyContainer

Represents a (SecureEnclave) private key, namely PrK_SE_AUT, secured by iOS Biometrics.

[REQ:gemSpec_IDP_Frontend:A_21590] This is the container to represent biometric keys. Usage is limited to authorization purposes [REQ:BSI-eRp-ePA:O.Cryp_7#2] Container for private key operations using secure enclave private keys

  • Declaration

    Swift

    public enum Error : Swift.Error
  • Initializes a PrivateKeyContainer for a given tag. Throws PrivateKeyContainer.Error in case of a failure.

    Throws

    PrivateKeyContainer.Error in case of a failure.

    Declaration

    Swift

    public init(with tag: String) throws

    Parameters

    tag

    The tag or identifier of the key.

  • Deletes an existing secure enclave key.

    Throws

    PrivateKeyContainer.Error in case of a failure or a missing key.

    Declaration

    Swift

    public static func deleteExistingKey(for tag: String) throws -> Bool

    Parameters

    tag

    The tag or identifier of the key.

    Return Value

    true in case of a success, throws otherwise.

  • Creates a PrivateKeyContainer with a given tag. Throws PrivateKeyContainer.Error in case of a failure.

    Throws

    PrivateKeyContainer.Error in case of a failure or a missing key.

    Declaration

    Swift

    public static func createFromSecureEnclave(with tag: String) throws -> PrivateKeyContainer

    Parameters

    tag

    The tag or identifier of the key.

    Return Value

    An instance of PrivateKeyContainer if successfull.

  • key creation without secure enclave for integration tests. Only available for simulator builds to enable integration tests.

    Declaration

    Swift

    public static func createFromKeyChain(with tag: String) throws -> PrivateKeyContainer
  • Sign the given Data with the private key.

    Throws

    PrivateKeyContainer.Error in case of a failure or a missing key.

    Declaration

    Swift

    public func sign(data: Data) throws -> Data

    Parameters

    data

    Data to sign with the private key.

    Return Value

    Data in concat format containing the Signature r | s.