0

SSL 証明書を使用して API を呼び出そうとしています。-Djavax.net.debug = all log から、次の手順を実行しています。

  1. 「Server Hello Done」を受け取りました
  2. クライアント鍵交換: RSA PreMasterSecret、TLSv1
  3. クライアントキー交換で完了ステータスを受け取りました
  4. 暗号仕様の変更: 失敗

    RECV TLSv1 ALERT:  
    fatal, 
    handshake_failure
    %% Invalidated:  [Session-1, SSL_RSA_WITH_RC4_128_MD5]
    

JCE無制限強度ポリシーファイルでJDK1.7を使用しています。助けてくれてありがとう。

編集: Server Hello Done とクライアント鍵交換の間

*** ServerHelloDone
[read] MD5 and SHA1 hashes:  len = 4
0000: 0E 00 00 00                                        ....
*** Certificate chain
*** ClientKeyExchange, RSA PreMasterSecret, TLSv1

SSL Socket Factory をセットアップするためのコード:

System.setProperty('javax.net.ssl.keyStore', 'jksfile')
System.setProperty('javax.net.ssl.keyStorePassword', '')
System.setProperty("https.protocols", "TLSv1");

System.setProperty('javax.net.ssl.trustStore', 'C:/Program Files/Java/jdk1.7.0_79/jre/lib/security/cacerts')
System.setProperty('javax.net.ssl.trustStorePassword', '')

SSLContext sslcontext = SSLContext.getInstance("TLSv1");
        sslcontext.init(null, null, null);

    HostnameVerifier allHostsValid = new HostnameVerifier() {
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    };
    HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
    HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();


    if (conn instanceof HttpsURLConnection){
        conn.setSSLSocketFactory(sslcontext.getSocketFactory());
    } 
4

0 に答える 0