SSL Certificate Verification : javax.net.ssl.SSLHandshakeException

后端 未结 3 1947
别那么骄傲
别那么骄傲 2020-12-29 00:13

I am trying to call a HTTPS REST API through Jersey Client. And on the course of development i stumble upon following error :

Exception in thread         


        
3条回答
  •  误落风尘
    2020-12-29 00:54

    There is a label software bug with the Java Keytool for Java version 1.7.0_60-b19, when creating a self signed certificate. See these instructions for a reference.

    https://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-using-java-keytool.html

    When it prompts you for "What is your first and last name?", instead of typing your name, you should enter the common name, or (fully qualified domain name of your server).

    [root@localhost ~]# keytool -genkey -keyalg RSA -alias myalias -keystore keystore.jks -storepass XXXXXX -validity 360 -keysize 2048
    What is your first and last name?
      [Unknown]:  Angus MacGyver
    What is the name of your organizational unit?
      [Unknown]:  My Department
    What is the name of your organization?
      [Unknown]:  My Company
    What is the name of your City or Locality?
      [Unknown]:  My City
    What is the name of your State or Province?
      [Unknown]:  My State
    What is the two-letter country code for this unit?
      [Unknown]:  US
    Is CN=Angus MacGyver, OU=My Department, O=My Company, L=My City, ST=My State, C=US correct?
      [no]:  yes
    Enter key password for 
            (RETURN if same as keystore password):XXXXXX
    Re-enter new password:XXXXXX
    

    You can verify if the "CN" (common name) attribute gets set correctly by calling this:

    [root@localhost ~]# keytool -v -list -keystore keystore.jks
    

    Find Java version:

    [root@localhost ~]# java -version
    java version "1.7.0_60"
    Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
    Java HotSpot(TM) Client VM (build 24.60-b09, mixed mode, sharing)
    

提交回复
热议问题