PsaRawKeyAgreement

Perform a key agreement and return the raw shared secret. Opcode: 19 (0x0013)

Parameters

NameTypeDescription
algRawKeyAgreementThe key agreement algorithm to compute
private_key_nameStringName of the private key to use
peer_keyVector of unsigned bytesPublic key of the peer
  • private_key_name must allow the usage flag derive.
  • peer_key must be in the same format that PsaImportKey accepts.

Results

NameTypeDescription
shared_secretVector of unsigned bytesThe raw shared secret

Specific response status codes

  • PsaErrorNotPermitted: The key does not have the derive usage flag, or does not permit the requested algorithm.
  • PsaErrorInvalidArgument: private_key_name is not compatible with alg, or peer_key_name is not valid for alg or not compatible with private_key_name.
  • PsaErrorNotSupported: alg is not a supported key agreement algorithm.

Description

Warning: The raw result of a key agreement algorithm such as finite-field Diffie-Hellman or elliptic curve Diffie-Hellman has biases, and is not suitable for use as key material. Instead it is recommended that the result is used as input to a key derivation algorithm. To chain a key agreement with a key derivation, use psa_key_derivation_key_agreement() and other functions from the key derivation interface.

Contract

Protobuf

Copyright 2020 Contributors to the Parsec project.