(->key k)
idempotent function converting input into a key
(-> {:type "AES", :mode :secret, :format "RAW", :encoded "euHlt5sHWhRpbKZHjrwrrQ=="} (->key) (->key)) => java.security.Key
idempotent function converting input into a key (-> {:type "AES", :mode :secret, :format "RAW", :encoded "euHlt5sHWhRpbKZHjrwrrQ=="} (->key) (->key)) => java.security.Key
(cipher)
(cipher name)
(cipher name provider)
lists or returns available Cipher
implementations
(cipher) => ("AES" "AESWrap" "AESWrap_128" ...)
(cipher "AES") => javax.crypto.Cipher
lists or returns available `Cipher` implementations (cipher) => ("AES" "AESWrap" "AESWrap_128" ...) (cipher "AES") => javax.crypto.Cipher
(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"
decrypts a byte array using a key (-> (decrypt (encode/from-hex "30491ab4427e45909f3d2f5d600b0f93") {:type "AES", :mode :secret, :format "RAW", :encoded "euHlt5sHWhRpbKZHjrwrrQ=="}) (String.)) => "hello world"
(digest)
(digest bytes algo)
(digest bytes algo {:keys [provider] :as opts})
creates a digest out of a byte array
(digest) => (contains ["MD2" "MD5" "SHA" "SHA-224" "SHA-256" "SHA-384" "SHA-512"] :in-any-order :gaps-ok)
(-> (digest (.getBytes "hello world") "SHA") (encode/to-hex)) => "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"
creates a digest out of a byte array (digest) => (contains ["MD2" "MD5" "SHA" "SHA-224" "SHA-256" "SHA-384" "SHA-512"] :in-any-order :gaps-ok) (-> (digest (.getBytes "hello world") "SHA") (encode/to-hex)) => "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"
(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"
encrypts a byte array using a key (-> (encrypt (.getBytes "hello world") {:type "AES", :mode :secret, :format "RAW", :encoded "euHlt5sHWhRpbKZHjrwrrQ=="}) (encode/to-hex)) => "30491ab4427e45909f3d2f5d600b0f93"
(generate-key)
(generate-key algo {:keys [provider] :as opts})
generates a key according to algorithm
(generate-key) => ("AES" "ARCFOUR" "Blowfish" "DES" "DESede" "HmacMD5" "HmacSHA1" "HmacSHA224" "HmacSHA256" "HmacSHA384" "HmacSHA512" ...)
(generate-key "AES" {:length 128}) ;;=> #key {:type "AES", ;; :mode :secret, ;; :format "RAW", ;; :encoded "AQgv8l+vJNfnEWuhHs55wg=="}
(generate-key "HmacSHA224" {:length 40}) ;;=> #key {:type "HmacSHA224", ;; :mode :secret, ;; :format "RAW", ;; :encoded "0qQkmic="}
generates a key according to algorithm (generate-key) => ("AES" "ARCFOUR" "Blowfish" "DES" "DESede" "HmacMD5" "HmacSHA1" "HmacSHA224" "HmacSHA256" "HmacSHA384" "HmacSHA512" ...) (generate-key "AES" {:length 128}) ;;=> #key {:type "AES", ;; :mode :secret, ;; :format "RAW", ;; :encoded "AQgv8l+vJNfnEWuhHs55wg=="} (generate-key "HmacSHA224" {:length 40}) ;;=> #key {:type "HmacSHA224", ;; :mode :secret, ;; :format "RAW", ;; :encoded "0qQkmic="}
(generate-key-pair)
(generate-key-pair type {:keys [provider] :as opts})
creates a public and private key pair
(generate-key-pair) => ("DSA" "DiffieHellman" "EC" "RSA")
(generate-key-pair "RSA" {:length 512}) ;;=> [#key {:type "RSA", ;; :mode :public, ;; :format "X.509", ;; :encoded "...." } ;; #key {:type "RSA", ;; :mode :private, ;; :format "PKCS#8", ;; :encoded "..."}]
creates a public and private key pair (generate-key-pair) => ("DSA" "DiffieHellman" "EC" "RSA") (generate-key-pair "RSA" {:length 512}) ;;=> [#key {:type "RSA", ;; :mode :public, ;; :format "X.509", ;; :encoded "...." } ;; #key {:type "RSA", ;; :mode :private, ;; :format "PKCS#8", ;; :encoded "..."}]
(hmac)
(hmac bytes key)
(hmac bytes key {:keys [algorithm provider] :as opts})
creates a key encrypted digest
(-> (hmac (.getBytes "hello world") {:type "HmacSHA1", :mode :secret, :format "RAW", :encoded "wQ0lyydDSEFRKviwv/2BoWVQDpj8hbUiUXytuWj7Yv8="}) (encode/to-hex)) => "a6f9e08fad62f63a35c6fd320f4249c9ad3079dc"
creates a key encrypted digest (-> (hmac (.getBytes "hello world") {:type "HmacSHA1", :mode :secret, :format "RAW", :encoded "wQ0lyydDSEFRKviwv/2BoWVQDpj8hbUiUXytuWj7Yv8="}) (encode/to-hex)) => "a6f9e08fad62f63a35c6fd320f4249c9ad3079dc"
(key->map k)
returns a map representation of a key
(key->map (generate-key "AES" {:length 128})) => (contains {:type "AES", :mode :secret, :format "RAW", :encoded string?})
returns a map representation of a key (key->map (generate-key "AES" {:length 128})) => (contains {:type "AES", :mode :secret, :format "RAW", :encoded string?})
(key-generator)
(key-generator name)
(key-generator name provider)
lists or returns available KeyGenerator
implementations
(key-generator) => ("AES" "ARCFOUR" "Blowfish" ...)
(key-generator "Blowfish") => javax.crypto.KeyGenerator
lists or returns available `KeyGenerator` implementations (key-generator) => ("AES" "ARCFOUR" "Blowfish" ...) (key-generator "Blowfish") => javax.crypto.KeyGenerator
(key-pair-generator)
(key-pair-generator name)
(key-pair-generator name provider)
lists or returns available KeyPairGenerator
implementations
(key-pair-generator) => ("DSA" "DiffieHellman" "EC" "RSA")
(key-pair-generator "RSA") => java.security.KeyPairGenerator
lists or returns available `KeyPairGenerator` implementations (key-pair-generator) => ("DSA" "DiffieHellman" "EC" "RSA") (key-pair-generator "RSA") => java.security.KeyPairGenerator
(key-store)
(key-store name)
(key-store name provider)
lists or returns available KeyStore
implementations
(key-store) => ("CaseExactJKS" "DKS" "JCEKS" "JKS" "KeychainStore" "PKCS12")
(key-store "JKS") => java.security.KeyStore
lists or returns available `KeyStore` implementations (key-store) => ("CaseExactJKS" "DKS" "JCEKS" "JKS" "KeychainStore" "PKCS12") (key-store "JKS") => java.security.KeyStore
(list-providers)
list all security providers
(list-providers) => ["Apple" "SUN" "SunEC" "SunJCE" "SunJGSS" "SunJSSE" "SunPCSC" "SunRsaSign" "SunSASL" "XMLDSig"]
list all security providers (list-providers) => ["Apple" "SUN" "SunEC" "SunJCE" "SunJGSS" "SunJSSE" "SunPCSC" "SunRsaSign" "SunSASL" "XMLDSig"]
(list-services)
(list-services type)
(list-services type provider)
lists all services that are available
(list-services) => ("AlgorithmParameterGenerator" "AlgorithmParameters" ...)
(list-services "Cipher") => ("AES" "AESWrap" "AESWrap_128" ...)
(list-services "KeyGenerator" "SunJCE") => ("AES" "ARCFOUR" "Blowfish" "DES" "DESede" ...)
lists all services that are available (list-services) => ("AlgorithmParameterGenerator" "AlgorithmParameters" ...) (list-services "Cipher") => ("AES" "AESWrap" "AESWrap_128" ...) (list-services "KeyGenerator" "SunJCE") => ("AES" "ARCFOUR" "Blowfish" "DES" "DESede" ...)
(mac)
(mac name)
(mac name provider)
lists or returns available Mac
implementations
(mac) => ("HmacMD5" "HmacPBESHA1" "HmacSHA1" ...)
(mac "HmacMD5") => javax.crypto.Mac
lists or returns available `Mac` implementations (mac) => ("HmacMD5" "HmacPBESHA1" "HmacSHA1" ...) (mac "HmacMD5") => javax.crypto.Mac
(message-digest)
(message-digest name)
(message-digest name provider)
lists or returns available MessageDigest
implementations
(message-digest) => ("MD2" "MD5" "SHA" "SHA-224" "SHA-256" "SHA-384" "SHA-512")
(message-digest "MD2") => java.security.MessageDigest$Delegate
lists or returns available `MessageDigest` implementations (message-digest) => ("MD2" "MD5" "SHA" "SHA-224" "SHA-256" "SHA-384" "SHA-512") (message-digest "MD2") => java.security.MessageDigest$Delegate
(sign)
(sign bytes key {:keys [algorithm provider] :as opts})
creates a signature using a private key
(sign) ;; => (contains ["MD2withRSA" "MD5andSHA1withRSA" "MD5withRSA" ;; "NONEwithDSA" "NONEwithECDSA" "SHA1withDSA" ;; "SHA1withECDSA" "SHA1withRSA" "SHA224withDSA" ;; "SHA224withECDSA" "SHA224withRSA" "SHA256withDSA" ;; "SHA256withECDSA" "SHA256withRSA" "SHA384withECDSA" ;; "SHA384withRSA" "SHA512withECDSA" "SHA512withRSA"] ;; :in-any-order)
(-> (sign (.getBytes "hello world") {:type "RSA", :mode :private, :format "PKCS#8", :encoded (apply str ["MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAmrOdqA5ZGMJ6" "55meZCnj44B65ZUXnAscXu7GJcNQO91Z7B9NmWX/P59BBUC/yJ6s/ugEffhP" "wCYJt013GkV6tQIDAQABAkBJxzV+C3G0XDOvNlUSoeO8AO8bhJIg6i+amrdH" "FTGzimwp/eyOGZlXpHcaK57kSBK4npXgfWCFFLNuvAtCrQ91AiEA0McEFHMS" "MTVU/78kDYSsJ+lty6izxkONp/XZ4+T6BDsCIQC9sWmBYAFDfiHvLnv2NT7O" "08LR+UnNuDalduukc649zwIhAKXHEadHRA/M4GR/Gxqc2bKLeUJ4/98TrvzK" "jCyYmioXAiAiOg2wY1M3C14yGvARB6ByjzD61AEmFlP93Qw9mwXYbwIhALR/" "Uv4DvJJbR7mpRXcRCo9Me1wawdCndM5ZyF7Hvpu4"])} {:algorithm "MD5withRSA"}) (encode/to-hex)) => (apply str ["5ba863c3e24c73f09d50749698ae82406490c" "edc4566810461480e37da661754b7bf33cc6b" "bf0f48646304c8994202d2fd7094e7420049f" "eaa512c8cd72d7000"])
creates a signature using a private key (sign) ;; => (contains ["MD2withRSA" "MD5andSHA1withRSA" "MD5withRSA" ;; "NONEwithDSA" "NONEwithECDSA" "SHA1withDSA" ;; "SHA1withECDSA" "SHA1withRSA" "SHA224withDSA" ;; "SHA224withECDSA" "SHA224withRSA" "SHA256withDSA" ;; "SHA256withECDSA" "SHA256withRSA" "SHA384withECDSA" ;; "SHA384withRSA" "SHA512withECDSA" "SHA512withRSA"] ;; :in-any-order) (-> (sign (.getBytes "hello world") {:type "RSA", :mode :private, :format "PKCS#8", :encoded (apply str ["MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAmrOdqA5ZGMJ6" "55meZCnj44B65ZUXnAscXu7GJcNQO91Z7B9NmWX/P59BBUC/yJ6s/ugEffhP" "wCYJt013GkV6tQIDAQABAkBJxzV+C3G0XDOvNlUSoeO8AO8bhJIg6i+amrdH" "FTGzimwp/eyOGZlXpHcaK57kSBK4npXgfWCFFLNuvAtCrQ91AiEA0McEFHMS" "MTVU/78kDYSsJ+lty6izxkONp/XZ4+T6BDsCIQC9sWmBYAFDfiHvLnv2NT7O" "08LR+UnNuDalduukc649zwIhAKXHEadHRA/M4GR/Gxqc2bKLeUJ4/98TrvzK" "jCyYmioXAiAiOg2wY1M3C14yGvARB6ByjzD61AEmFlP93Qw9mwXYbwIhALR/" "Uv4DvJJbR7mpRXcRCo9Me1wawdCndM5ZyF7Hvpu4"])} {:algorithm "MD5withRSA"}) (encode/to-hex)) => (apply str ["5ba863c3e24c73f09d50749698ae82406490c" "edc4566810461480e37da661754b7bf33cc6b" "bf0f48646304c8994202d2fd7094e7420049f" "eaa512c8cd72d7000"])
(signature)
(signature name)
(signature name provider)
lists or returns available Signature
implementations
(signature) => ("MD2withRSA" "MD5andSHA1withRSA" "MD5withRSA" ...)
(signature "MD2withRSA") => java.security.Signature$Delegate
lists or returns available `Signature` implementations (signature) => ("MD2withRSA" "MD5andSHA1withRSA" "MD5withRSA" ...) (signature "MD2withRSA") => java.security.Signature$Delegate
(verify)
(verify bytes signature key {:keys [algorithm provider] :as opts})
verifies a signature using a public key
(verify (.getBytes "hello world") (->> ["5ba863c3e24c73f09d50749698ae82406490c" "edc4566810461480e37da661754b7bf33cc6b" "bf0f48646304c8994202d2fd7094e7420049f" "eaa512c8cd72d7000"] (apply str) (encode/from-hex)) {:type "RSA", :mode :public, :format "X.509", :encoded (apply str ["MFwwDQYJKoZIhvcNAQEBBQADSwAwSA" "JBAJqznagOWRjCeueZnmQp4+OAeuWV" "F5wLHF7uxiXDUDvdWewfTZll/z+fQQ" "VAv8ierP7oBH34T8AmCbdNdxpFerUC" "AwEAAQ=="])} {:algorithm "MD5withRSA"}) => true
verifies a signature using a public key (verify (.getBytes "hello world") (->> ["5ba863c3e24c73f09d50749698ae82406490c" "edc4566810461480e37da661754b7bf33cc6b" "bf0f48646304c8994202d2fd7094e7420049f" "eaa512c8cd72d7000"] (apply str) (encode/from-hex)) {:type "RSA", :mode :public, :format "X.509", :encoded (apply str ["MFwwDQYJKoZIhvcNAQEBBQADSwAwSA" "JBAJqznagOWRjCeueZnmQp4+OAeuWV" "F5wLHF7uxiXDUDvdWewfTZll/z+fQQ" "VAv8ierP7oBH34T8AmCbdNdxpFerUC" "AwEAAQ=="])} {:algorithm "MD5withRSA"}) => true
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close