How to debug the ssl connection error

后端 未结 1 878
-上瘾入骨i
-上瘾入骨i 2020-12-11 12:44

Description: I tried to post some xml format data to a API gateway. When i post my data to one site under Https protocol with JAVA HttpsURLConnection, i got

相关标签:
1条回答
  • 2020-12-11 13:00

    The site you're attempting to connect (alipay-test.connectedpos.de) does not have any cipher suites in common with Java.

    TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030)
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (0xc028)
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)
    TLS_RSA_WITH_AES_256_GCM_SHA384 (0x9d)
    TLS_RSA_WITH_AES_256_CBC_SHA256 (0x3d)
    TLS_RSA_WITH_AES_256_CBC_SHA (0x35)
    TLS_RSA_WITH_CAMELLIA_256_CBC_SHA (0x84)
    

    You will need to enable the JCE Unlimited Strength Jurisdiction Policy for Java for this to work.

    For Java 7, you can download the JCE Unlimited Strength Jurisdiction Policy files from http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html. For all versions of Java 8 except Update 151, you can download the files from http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html. Once done, replace the two JARs (local_policy.jar, US_export_policy.jar) under your JRE's lib/security directory with the ones from the downloaded package.

    For Java 8 Update 151 and later, the files are installed by default. To enable these file, edit the file java.security under your JRE's lib/security directory and specify crypto.policy=unlimited.

    This will add additional (stronger) ciphersuites and you should be able to connect without having to make any changes to your code or enable TLSv1.2

    0 讨论(0)
提交回复
热议问题