Skip to main content

aes_gcm_decrypt

Function aes_gcm_decrypt 

Source
pub fn aes_gcm_decrypt<'py>(
    py: Python<'py>,
    key: &[u8],
    nonce: &[u8],
    ciphertext_with_tag: &[u8],
    aad: Option<&[u8]>,
) -> PyResult<Bound<'py, PyBytes>>
Expand description

Decrypt and verify data using AES-GCM.

ciphertext_with_tag must be the output of :func:aes_gcm_encrypt: ciphertext followed by a 16-byte authentication tag. nonce and aad must match those used during encryption.

Raises :exc:ValueError if the authentication tag does not verify.

import synta.crypto as sc

pt = sc.aes_gcm_decrypt(key, nonce, ciphertext_with_tag, b"extra-data")