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

Cipher class function

The cipher class is intended for integrators familiar with basic crypto concepts.

FunctionDescriptionSample
nevis.crypto.cipher.new(mode, algorithm, key, IV)Instantiate a new crypto cipher object with the following options:mode: ENCRYPTDECRYPTalgorithm: Blowfish, DES, DESede, RC4, AES and AES/GCMkey: Key for encryption/decryptionIV: Initialization Value for encryption/decryption.

Both key and IV are 16 bytes long, except for AES/GCM, where the key is 32, and the IV is 12 bytes long. Longer values are truncated, shorter values are extended with "@" characters up to 16 bytes.

They are interpreted as an ASCII string (1 byte per character), but they are not limited to ASCII characters.

For non-ASCII values, use \x00 - \xFF.

There are no default values for IV or key, both of them have to be given during object instantiation.

We recommend you use unique random IVs per encryption.