Skip to main content
Version: 8.2405.x.x RR

AesGcmEncrypter class function

The AesGcmEncrypter class is intended for integrators without basic knowledge of cryptography.

Added features compared to Crypto class:

  • A basic KDF function is used to generate proper encryption keys based on arbitrary length passwords.
  • Randomized IVs are automatically used.
  • The ciphered data is Base64 encoded internally.
FunctionDescriptionSample
nevis.crypto.aesgcmencrypter.new(password, ivLen=12, tagLen=16)Instantiate a new encrypter object based on the AES-256-GCM cipher. Password length is arbitrary. Longer passwords offer higher entropy. The password's sha1 hash is used as the cipher's key (other systems might handle passwords differently). The password is interpreted as an ASCII string (1 byte per character), but it is not limited to ASCII characters. For non-ASCII values, use \x00 - \xFF. The ivLen sets the length of the generated IV-s. It has no effect when the user supplies the IV to the encrypt and decrypt functions. The default IV length is 12 cipher. Phe tagLen sets the authentication tag's length used to protect the encrypted data against tampering. The default tag length is 16 bytes.cryptoEngine = nevis.crypto.aesgcmencrypter.new("secret_password", 12, 16)