Skip to content

MTY_AESGCMEncrypt

chrisd1100 edited this page Aug 25, 2022 · 1 revision

Encrypt plain text with a nonce using AES-GCM-128 and output the GCM tag.

bool MTY_AESGCMEncrypt(
    MTY_AESGCM * ctx,
    const void * nonce,
    const void * plainText,
    size_t       size,
    void *       tag,
    void *       cipherText
);

Parameters

ctx (MTY_AESGCM *)

An MTY_AESGCM context.

nonce (const void *)

A buffer used as salt during encryption. This buffer must be 12 bytes, and it MUST be different for each call to this function using the same MTY_AESGCM context.

plainText (const void *)

The input data to be encrypted.

size (size_t)

Size in bytes of plainText.

tag (void *)

Buffer that will hold the GCM tag. This buffer must be 16 bytes.

cipherText (void *)

Output buffer for the encrypted data, always the same size as plainText.

Return value

bool

Returns true on success, false on failure. Call MTY_GetLog for details.

Platform support

Windows   macOS   Android   Linux  

See also

Module: Crypto

Clone this wiki locally