Crypt::...:GCMSIV(3)
okay bestie, welcome to Crypt::...:GCMSIV(3) π this is a User Contributed Perl Documentation page, and itβs all about keeping your AES-GCM-SIV game strong. no cap, letβs go.
π NAME π
Crypt::AuthEnc::GCMSIV β Authenticated encryption in AES-GCM-SIV mode (RFC 8452)
π¦ SYNOPSIS π¦
use Crypt::AuthEnc::GCMSIV qw( gcm_siv_encrypt_authenticate gcm_siv_decrypt_verify );
my $ciphertext = gcm_siv_encrypt_authenticate('AES', $key, $nonce, $adata, $plaintext);
my $plaintext = gcm_siv_decrypt_verify('AES', $key, $nonce, $adata, $ciphertext); # undef on failure
πΈ DESCRIPTION πΈ
Since: CryptX-0.090
AES-GCM-SIV is a nonce-misuse-resistant authenticated encryption scheme defined in RFC 8452 <https://www.rfc-editor.org/rfc/rfc8452>. Reusing a nonce with the same key no longer reveals the plaintext or the authentication key; it only reveals whether the same (plaintext, AAD) pair was encrypted twice. itβs giving iconic, honestly.
The output of gcm_siv_encrypt_authenticate is the ciphertext with a 16-byte authentication tag appended (total output length is length($plaintext) + 16).
GCM-SIV is defined only for 128-bit block ciphers (i.e. AES); the nonce must be exactly 12 bytes long and the key must be 16 or 32 bytes (AES-128 / AES-256).
β¨ EXPORT β¨
Nothing is exported by default.
You can export selected functions:
use Crypt::AuthEnc::GCMSIV qw( gcm_siv_encrypt_authenticate gcm_siv_decrypt_verify );
π FUNCTIONS π
π₯ gcm_siv_encrypt_authenticate π₯
my $ciphertext = gcm_siv_encrypt_authenticate($cipher, $key, $nonce, $adata, $plaintext);
# $cipher ... [string] cipher name (must be 'AES')
# $key ... [binary string] 16- or 32-byte key
# $nonce ... [binary string] 12-byte nonce
# $adata ... [binary string | undef] optional associated data
# $plaintext ... [binary string] plaintext to encrypt
Returns a string of length($plaintext) + 16 bytes: ciphertext followed by the 16-byte authentication tag.
The required string/buffer arguments must be plain scalars; $adata may be undef to indicate no associated data. String-overloaded objects are accepted.
π₯ gcm_siv_decrypt_verify π₯
my $plaintext = gcm_siv_decrypt_verify($cipher, $key, $nonce, $adata, $ciphertext);
# $cipher ... [string] cipher name (must be 'AES')
# $key ... [binary string] 16- or 32-byte key
# $nonce ... [binary string] 12-byte nonce
# $adata ... [binary string | undef] optional associated data (must match the value used during encryption)
# $ciphertext ... [binary string] ciphertext with 16-byte tag appended
Returns the plaintext on success, or undef if authentication fails. Malformed input shorter than 16 bytes croaks because it cannot contain the required appended tag.
bestie, do not sleep on that $adata note: it must match the value used during encryption. π
π SEE ALSO π
CryptX,Crypt::AuthEnc::GCM,Crypt::AuthEnc::SIVRFC 8452 <https://www.rfc-editor.org/rfc/rfc8452>
thatβs the whole page, bestie! π brought to you by Crypt::...:GCMSIV(3), perl v5.44.0, dated 2026-10-17 π«Άβ¨
π¦ where this page comes from
- arch rolling: perl-cryptx 0.091-2 Β· PerlArtistic AND GPL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms