Skip to content

miniproto.crypto.native.aes_256_gcm_encrypt_cryptography

miniproto.crypto.native.aes_256_gcm_encrypt_cryptography

Section titled “miniproto.crypto.native.aes_256_gcm_encrypt_cryptography”
aes_256_gcm_encrypt_cryptography(plaintext: bytes, key: bytes, nonce: bytes, associated_data: bytes) -> bytes

Encrypt and authenticate with the explicit cryptography AES-GCM path.

Parameters:

  • plaintext (bytes) – Bytes to protect.
  • key (bytes) – AES-256 key material accepted by cryptography.
  • nonce (bytes) – Nonce bytes accepted by cryptography; use a unique 12-byte nonce for interoperable native parity.
  • associated_data (bytes) – Authenticated but unencrypted bytes.

Returns:

  • bytes – Ciphertext with its appended authentication tag.

Raises:

  • ValueError – If cryptography rejects the inputs.

This explicitly bypasses Rust. It does not track nonce reuse or clear secret buffers.