keyAgreement

open suspend override fun keyAgreement(alias: String, otherKey: EcPublicKey, keyUnlockData: KeyUnlockData?): ByteArray

Performs Key Agreement.

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.

Return

The shared secret.

Parameters

alias

the alias of the EC key to use.

otherKey

The public EC key from the other party

keyUnlockData

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

Throws

if there is no key with the given alias or the key wasn't created with purpose KeyPurpose.AGREE_KEY.

if the key needs unlocking.

KeyInvalidatedException

if the key is no longer usable.