getOrCreateInstance

fun getOrCreateInstance(algorithm: SigningAlgorithm, keyId: String?, keySizeInBits: Int = 2048, strongBoxPreference: SecureHardwarePreference = SecureHardwarePreference.None): AndroidKeyStoreSigningKey(source)

Returns an AndroidKeyStoreSigningKey for the given algorithm and keyId, generating a new key in the Android Keystore if one does not already exist.

Parameters

keyId

The Android Keystore alias to use. When null, a library-managed default alias derived from algorithm is used.

keySizeInBits

RSA key size in bits, used when algorithm is RSA-based. Ignored for ECDSA and HMAC keys. Defaults to 2048.

strongBoxPreference

Controls whether the key is generated inside StrongBox. Defaults to SecureHardwarePreference.None.