sign

open suspend override fun sign(alias: String, dataToSign: ByteArray, keyUnlockData: KeyUnlockData?): EcSignature

Signs data with a key.

If the key needs unlocking before use (for example user authentication in any shape or form) and keyUnlockData isn't set or doesn't contain what's needed, KeyLockedException is thrown. Signature algorithm must be specified at key creation time using CreateKeySettings.signingAlgorithm.

Return

the signature.

Parameters

alias

The alias of the EC key to sign with.

dataToSign

the data to sign.

keyUnlockData

data used to unlock the key, null, or a KeyUnlockInteractive to handle user authentication automatically.

Throws

if the signature algorithm isn’t compatible with the key.

if the key needs unlocking.

KeyInvalidatedException

if the key is no longer usable.