Created
October 24, 2011 21:26
-
-
Save pcarrier/1310364 to your computer and use it in GitHub Desktop.
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
(ns moob.sslbs | |
(:import (java.io InputStreamReader Reader) | |
(java.net URL | |
URLConnection) | |
(javax.net.ssl HostnameVerifier HttpsURLConnection | |
SSLContext SSLSession TrustManager | |
X509TrustManager) | |
(java.security cert.X509Certificate SecureRandom))) | |
(defn disable | |
[] | |
(let [ tm (into-array TrustManager | |
[(proxy [X509TrustManager] | |
[] | |
(getAcceptedIssuers [] nil) | |
(checkClientTrusted [certs auth-type]) | |
(checkServerTrusted [certs auth-type]))]) | |
sslctx (SSLContext/getInstance "SSL") | |
] | |
(.init sslctx nil tm (SecureRandom.)) | |
(HttpsURLConnection/setDefaultSSLSocketFactory (.getSocketFactory sslctx)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment