getOrCreateInstance

fun getOrCreateInstance(algorithm: EncryptionAlgorithm, keyId: String?, keySizeInBits: Int = 2048, strongBoxPreference: SecureHardwarePreference = SecureHardwarePreference.Preferred): AndroidKeyStoreEncryptionKey(source)

Returns an AndroidKeyStoreEncryptionKey for the given algorithm and keyId, generating a new RSA key pair 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. Defaults to 2048.

strongBoxPreference

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


fun getOrCreateInstance(algorithm: EncryptionAlgorithm.Dir, keyId: String?, keySizeInBits: Int = 2048, strongBoxPreference: SecureHardwarePreference = SecureHardwarePreference.None): AndroidKeyStoreEncryptionKey(source)

Deprecated (with error)

AndroidKeyStoreEncryptionKey does not support the Dir algorithm. Use a symmetric key provider instead.