createKey

abstract suspend fun createKey(alias: String?, createKeySettings: CreateKeySettings): KeyInfo

Creates a new key.

This creates an Elliptic Curve key-pair where the private part of the key is never exposed to the user of this interface.

The public part of the key is available in KeyInfo.publicKey and specific implementations may expose attestations or other proof that the private part of the key never leaves secure hardware.

If an existing key with the given alias already exists it will be replaced by the new key.

Return

a KeyInfo with information about the key.

Parameters

alias

A unique string to identify the newly created key. When null is passed, a new unique alias is generated automatically

createKeySettings

Throws

if the underlying Secure Area Implementation does not support the requested creation settings, for example the EC curve to use.