Clojure、SSL/x.509certs quetion
-
23-09-2019 - |
質問
私は書く必要がある単純なプログラムのための作品は、以下の処理を行います:
- 読み込む設定ファイル
- 接続チサーバー
- 設立のsslソケット
- プル情報、サーバのx509certの有効期限は、現在のホスト名
- メールの報告が行われ
項目3-4などいっ研究/googleingと分かりませんjavaも、すべて1.2以降、2001年頃
解決 2
私は<のhref =「http://www.exampledepot.com/egs/javax.net.ssl/GetCert.html」のrel = "nofollowをでのJavaについて知っておくべきことを私に指示コードsnipitを見つけましたnoreferrer "> http://www.exampledepot.com/egs/javax.net.ssl/GetCert.html の
ここにある:
try {
// Create the client socket
int port = 443;
String hostname = "hostname";
SSLSocketFactory factory = HttpsURLConnection.getDefaultSSLSocketFactory();
SSLSocket socket = (SSLSocket)factory.createSocket(hostname, port);
// Connect to the server
socket.startHandshake();
// Retrieve the server's certificate chain
java.security.cert.Certificate[] serverCerts =
socket.getSession().getPeerCertificates();
// Close the socket
socket.close();
} catch (SSLPeerUnverifiedException e) {
} catch (IOException e) {
} catch (java.security.cert.CertificateEncodingException e) {
}
他のヒント
A詳細なアガイドのinnersのJava暗号化拡張であることが明らかにされたOraclesして、ホームページ: http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html
所属していません StackOverflow