anonymous

suspend fun anonymous(secureArea: SecureArea, alias: String, unlockReason: Reason = Reason.Unspecified, algorithm: Algorithm? = null): AsymmetricKey

Creates an anonymous AsymmetricKey referencing a key residing in a SecureArea.

Return

an anonymous AsymmetricKey.

Parameters

secureArea

the Secure Area holding the key.

alias

the alias of the key.

unlockReason

reason for unlocking the key.

algorithm

the algorithm to use, or null to use the key's default algorithm.

Throws

if no key with the given alias exists.


fun anonymous(privateKey: PrivateKey, algorithm: Algorithm = when (privateKey) { is EcPrivateKey -> privateKey.curve.defaultSigningAlgorithmFullySpecified is RsaPrivateKey -> Algorithm.RS256 is MlDsaPrivateKey -> privateKey.algorithm is MlKemPrivateKey -> privateKey.algorithm }): AsymmetricKey

Creates an anonymous AsymmetricKey wrapping a software PrivateKey.

Return

an anonymous AsymmetricKey.

Parameters

privateKey

the private key to wrap.

algorithm

the signing algorithm to use.