Symmetric Ciphers

Index

cipher/clear cipher/finish cipher/get-default-nonce-length cipher/get-keyspec cipher/get-tag-length cipher/get-update-granularity cipher/is-authenticated cipher/name cipher/new cipher/set-associated-data cipher/set-key cipher/start cipher/update cipher/valid-nonce-length

Reference

cipher/clearcfunction
(cipher/clear cipher-obj)

Reset the state of `cipher` back to clean, as if no key and input has been supplied. Returns `cipher-obj`.

cipher/finishcfunction
(cipher/finish cipher-obj input)

Finish processing (with an optional final `input`). May throw if message authentication checks fail, in which case all plaintext previously processed must be discarded. You may call `cipher/finish` with the entire message.

(cipher/get-default-nonce-length cipher-obj)

Returns default nonce length.

(cipher/get-keyspec cipher-obj)

Return the key spec of this `cipher` in format of `[max-key-length min-key-length mod-key-length]`.

(cipher/get-tag-length cipher-obj)

Returns the tag length (0 for unauthenticated modes).

(cipher/get-update-granularity cipher-obj)

Return the update granularity of the cipher. `cipher/update` must be called with blocks of this size, except for the final.

(cipher/is-authenticated cipher-obj)

Returns true if this is an AEAD mode.

cipher/namecfunction
(cipher/name cipher-obj)

Returns the name of this algorithm.

cipher/newcfunction
(cipher/new name type)

Creates an cipher object of the given name, e.g., "AES-256/GCM".Create an encryption cipher if `:encrypt` type is given, create decryption cipher if `:decrypt` type is supplied.

(cipher/set-associated-data cipher-obj ad)

Sets the associated data and returns `cipher-obj`. Fails if this is not an AEAD mode.

(cipher/set-key cipher-obj key)

Set the symmetric key to be used. Returns `cipher-obj`.

cipher/startcfunction
(cipher/start cipher-obj nonce)

Start processing a message using `nonce`. Returns `cipher-obj`.

cipher/updatecfunction
(cipher/update cipher-obj input)

Consumes `input` text and returns output. Input text must be of `cipher/get-update-granularity` length. Alternately, always call finish with the entire message, avoiding calls to update entirely.

(cipher/valid-nonce-length cipher-obj nonce-len)

Returns true if `nonce-len` is a valid nonce len for this mode.