keyAgreement

abstract suspend fun keyAgreement(otherKey: EcPublicKey): ByteArray

Performs Key Agreement using this key and otherKey.

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

otherKey

The public EC key from the other party

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.

if the key is no longer usable.