Decrypt a short message with a symmetric cipher. Opcode: 21 (0x0015)


key_nameStringName of the key to use for the operation
algCipherA cipher algorithm that is compatible with the type of key
ciphertextVector of bytesIV followed by the ciphertext
  • key_name must allow the usage flag decrypt.
  • ciphertext must be the IV followed by the ciphertext.


plaintextVector of bytesBuffer containing decrypted message

Specific response status codes

  • PsaErrorNotPermitted: The key does not have the decrypt flag, or it does not permit the requested algorithm.
  • PsaErrorInvalidPadding: The decrypted padding is incorrect. See Warning below.


This function will decrypt a short message using the provided initialisation vector (IV).

Warning: In some protocols, when decrypting data, it is essential that the behavior of the application does not depend on whether the padding is correct (see KlĂ­ma et al). Protocols that use authenticated encryption are recommended for use by applications, rather than plain encryption. If the application must perform a decryption of unauthenticated data, the application writer must take care not to reveal whether the padding is invalid.



Copyright 2020 Contributors to the Parsec project.