Skip to content

Instantly share code, notes, and snippets.

@kyleburton
Created May 24, 2011 19:42
Show Gist options
  • Save kyleburton/989520 to your computer and use it in GitHub Desktop.
Save kyleburton/989520 to your computer and use it in GitHub Desktop.
Clojure Java Security - enumerate providers, types and algorithms
(defn security-providers-type-algorithm-seq []
(mapcat (fn [provider]
(map (fn [svc]
[(.getType svc) (.getAlgorithm svc)])
(.getServices provider)))
(java.security.Security/getProviders)))
(defn security-providers-types []
(vec (set (map first (security-providers-type-algorithm-seq)))))
(defn security-providers-for-type [type]
(filter #(= (first %) type)
(security-providers-type-algorithm-seq)))
(defn message-digest-algorithms []
(security-providers-for-type "MessageDigest"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment