SecureEnclaveSecureArea

An implementation of SecureArea using the Apple Secure Enclave.

This implementation uses CryptoKit and only supports EcCurve.P256. Keys can optionally be protected by user authentication which can be specified using SecureEnclaveUserAuthType and SecureEnclaveCreateKeySettings.

Note that this platform automatically displays authentication dialogs when a key is used (if needed) unlike other SecureArea dialogs where the application is expected to show authentication dialogs via catching KeyUnlockData, preparing a KeyUnlockData, obtaining authentication, and then retrying the operation.

The behavior (for example, which message to show the user) of the platform native authentication dialog can be customized by passing a SecureEnclaveKeyUnlockData with a suitable LAContext object when the key is used. Note that the platform native authentication dialog will show even if this is not done.

As the Secure Enclave does not current support key attestation, the base KeyAttestation object is used.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val displayName: String

The name of the Secure Area, suitable for displaying to the end user.

Link copied to clipboard
open override val identifier: String

A stable identifier for the Secure Area.

Link copied to clipboard
open override val supportedAlgorithms: List<Algorithm>

The list of algorithms the Secure Area supports.

Functions

Link copied to clipboard
open suspend fun batchCreateKey(numKeys: Int, createKeySettings: CreateKeySettings): BatchCreateKeyResult

Creates a batch of new keys.

Link copied to clipboard
open suspend override fun createKey(alias: String?, createKeySettings: CreateKeySettings): KeyInfo

Creates a new key.

Link copied to clipboard
open suspend override fun deleteKey(alias: String)

Deletes a previously created key.

Link copied to clipboard
open suspend override fun getKeyInfo(alias: String): KeyInfo

Gets information about a key.

Link copied to clipboard
open suspend override fun getKeyInvalidated(alias: String): Boolean

Checks whether the key has been invalidated.

Link copied to clipboard
open suspend override fun keyAgreement(alias: String, otherKey: EcPublicKey, unlockReason: Reason): ByteArray

Performs Key Agreement.

Link copied to clipboard
open suspend override fun sign(alias: String, dataToSign: ByteArray, unlockReason: Reason): EcSignature

Signs data with a key.