Skip to main content

SecurityLocalEncryptAES128GCM

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

Description

Encrypts data with a given key, initialization vector and additional authentication data. The encryption is AES128 (GCM). Also stores tag.

Parameters

  • byte key[]: The key to be used for AES (16 bytes).
  • dword keyLength: 16 (bytes).
  • byte iv[]: The init vector.
  • dword ivLength: The length of the init vector.
  • byte aad[]: The additional authentication data.
  • dword aadLength: The length of the additional authentication data.
  • byte plainData[]: The data to encrypt.
  • dword plainDataLength: The length of the data.
  • byte tag[][out]: The buffer where to store the verification tag for the ciphered text.
  • dword tagLength: 16 (bytes).
  • byte cipheredData[][out]: The buffer in which the ciphered data is stored.
  • dword cipheredDataLength [in/out]: The length of the buffer. Typically this buffer should have the same length as the data to encrypt.

Return Values

  • 1: Success. A value of 1 means that the action was successful.
  • <= 0: Error. A value less than or equal to 0 means error.

Example

SecurityLocalDecryptAES128GCMSecurityLocalEncryptAES256GCM