chickadee » openssl » cipher-context-init!

cipher-context-init! context cipher key iv #!key (mode 'encrypt) (padding #t) effective-key-length auth-data tag-length expected-tag effective-iv-length message-lengthprocedure

Set up the cipher context object context for encryption/decryption using cipher with the key and iv parameters as blobs. iv may be #f in case the cipher doesn't require an IV (for example AES-ECB and RC4). The remaining key arguments are optional and follow the below rules:

  • mode must be either 'encrypt or 'decrypt.
  • padding may be #t or #f. When #f, the cipher input length must be a multiple of the block length in the case of a block cipher such as AES-CBC.
  • effective-key-length instructs OpenSSL to use up to the specified number of bytes of the key.
  • auth-data specifies an additional blob of non-secret data to use with an AEAD cipher.
  • tag-length specifies the length of the generated tag for AEAD ciphers. It must be set for both encryption and decryption mode.
  • expected-tag specifies the expected tag for AEAD ciphers. It must be set for decryption mode and is obtained with cipher-context-get-tag after encryption.
  • effective-iv-length instructs OpenSSL to use up to the specified number of bytes of the IV.
  • message-length specifies the length of the entire message to be encrypted/decrypted. It must be set when using CCM mode.