KeySecurityLevel enum

Where a key's private material is stored and used.

Reported for the signing key in KeyInfo.securityLevel and KeyCreationResult.securityLevel. Those fields are null when the platform can't tell: on Windows, Windows Hello doesn't say whether the TPM holds the key.

More values may be added in minor releases, so avoid exhaustive switches over this enum.

Inheritance
Available extensions

Values

strongBox → const KeySecurityLevel

Android A StrongBox secure element, a separate chip with its own CPU and storage (Android 9+ on devices that have one).

trustedEnvironment → const KeySecurityLevel

Android The Trusted Execution Environment of the main processor.

secureEnclave → const KeySecurityLevel

iOS/macOS The Secure Enclave. EC keys only; RSA keys report software.

secureHardware → const KeySecurityLevel

Android Secure hardware that can't be told apart further.

Android 9–11 (API 28–30) don't report whether a key is in StrongBox or the TEE, so keys on devices that have StrongBox report this there. Newer Android versions report it for secure hardware that is neither.

software → const KeySecurityLevel

The private key is used outside secure hardware.

  • Android: the keystore has no secure hardware (e.g. some emulators).
  • iOS/macOS: RSA keys. The Secure Enclave can't hold RSA keys, so the RSA private key is stored encrypted by a Secure Enclave EC key, which needs user authentication to unwrap it, but signing and decryption run in app memory.

Properties

hashCode → int
The hash code for this object.
no setterinherited
index → int
A numeric identifier for the enumerated value.
no setterinherited
name → String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

values → const List<KeySecurityLevel>
A constant List of the values in this enum, in order of their declaration.