Created
May 24, 2011 19:42
-
-
Save kyleburton/989520 to your computer and use it in GitHub Desktop.
Clojure Java Security - enumerate providers, types and algorithms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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