std.lib.security.cipher

decrypt

added in 3.0

(decrypt bytes key)(decrypt bytes key {:keys [algorithm params random iv], :as opts})

decrypts a byte array using a key

(-> (decrypt (encode/from-hex “30491ab4427e45909f3d2f5d600b0f93”) {:type “AES”, :mode :secret, :format “RAW”, :encoded “euHlt5sHWhRpbKZHjrwrrQ==”}) (String.)) => “hello world”

encrypt

added in 3.0

(encrypt bytes key)(encrypt bytes key {:keys [algorithm params random iv], :as opts})

encrypts a byte array using a key

(-> (encrypt (.getBytes “hello world”) {:type “AES”, :mode :secret, :format “RAW”, :encoded “euHlt5sHWhRpbKZHjrwrrQ==”}) (encode/to-hex)) => “30491ab4427e45909f3d2f5d600b0f93”

init-cipher

added in 3.0

(init-cipher cipher mode key {:keys [params random iv]})

initializes cipher according to options

operate

added in 3.0

(operate mode bytes key {:keys [algorithm], :as opts})

base function for encrypt and decrypt