keyAgreement

open suspend override fun keyAgreement(alias: String, otherKey: EcPublicKey, unlockReason: Reason): SecureByteString

Performs Key Agreement.

Key agreement is only supported for EC keys.

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

unlockReason

the reason for unlocking.

Throws

if there is no key with the given alias or the key wasn't created with a key agreement algorithm.

if the key needs unlocking.

if the key is no longer usable.