miniproto.crypto.native.aes_256_gcm_decrypt
miniproto.crypto.native.aes_256_gcm_decrypt
Section titled “miniproto.crypto.native.aes_256_gcm_decrypt”aes_256_gcm_decrypt(ciphertext_and_tag: bytes, key: bytes, nonce: bytes, associated_data: bytes) -> bytesAuthenticate and decrypt AES-256-GCM session bytes.
Parameters:
- ciphertext_and_tag (
bytes) – Ciphertext with its appended 16-byte GCM tag. - key (
bytes) – Exactly 32 bytes of AES-256 key material. - nonce (
bytes) – Exactly 12 bytes used for encryption. - associated_data (
bytes) – The exact authenticated but unencrypted bytes.
Returns:
bytes– Verified plaintext.
Raises:
ValueError– If the key/nonce is invalid or tag authentication fails.
Selects Rust only if its optional session-crypto capability is available,
otherwise cryptography. Never use returned plaintext after an error.