Skip to content

Key Management

dungexn edited this page May 6, 2024 · 2 revisions

Welcome to the Key Management wiki of eSIM Wallet. This wiki is documented with the motivation of breaking down Key Management of eSIM Wallet for everyone to understand.

eSIM Wallet Key Management

The below diagram explains a non-custodial key management approach of eSIM Wallet where end users' private key is generated and stored in their respective mobile device within an secure environment. KM

  • EC Key Manager deals with the generation and management of ECDSA keys, To generate Ethereum keys, uses Web3j and BouncyCastle libraries, The EC key pair is generated using the secp256k1 EC.

note : android keystore doesn't support secp256k1

Android Keystore

Here's a brief on Android Keystore:

  • Securely store cryptographic keys in a container to limit extraction from the device.
  • Use stored keys for cryptographic functions without exposing key material.

Security Measures:

  • External Protection: Prevents key material extraction from both apps and the device.
  • Internal Restrictions: Enforces specified key usages within the device, restricting unauthorized internal uses.

Extraction Prevention:

  • Application Isolation: Key material does not enter the app process, safeguarding against compromised apps.
  • Hardware Binding: Key material may be tied to device's secure hardware like TEE or SE, preventing key extraction even if the OS is compromised.

Hardware Security:

  • StrongBox Keymaster: Available on devices with Android 9 or higher, offers enhanced security with its own CPU, secure storage, and resistance to tampering.
  • Algorithm Support: Includes RSA, AES, ECDSA, and more, with preference for StrongBox via setIsStrongBoxBacked() method.

Key Use Authorizations:

  • Cryptographic Restrictions: Keys are limited to specific algorithms, operations, and cryptographic parameters.
  • Temporal Limits: Keys can be restricted to operate only within certain time frames.
  • User Authentication: Keys require recent user authentication to be used, with some conditions enforceable by secure hardware.

Notice:

On a suitable processor, the secure world runs a trusted execution environment (TEE) with a small operating system.
On reasonable modern Android versions, the keys of the Android keymaster are stored in the TEE, Android (even fully rooted) does not have direct access to them.
There are phones where the device encryption key resides inside the TEE, but this isn't always the case.

Clone this wiki locally