Adding an SSL Certificate to JRE in order to access HTTPS sites

前端 未结 1 386
-上瘾入骨i
-上瘾入骨i 2020-12-14 11:50

Context:

So I\'m trying to access an HTTPS site from my Java code but I am not able due to an SSL Handshake issues between my localhost and the serv

相关标签:
1条回答
  • 2020-12-14 12:08

    You should be able to import the server (self-signed?) SSL certificate onto your localhost using the command you specified. To be more complete, you can try

    $JAVA_HOME/bin/keytool -import -alias mycertificate -keystore path_to_keystore -file certificate_file 
    

    where

    • $JAVA_HOME on Mac is /System/Library/Frameworks/JavaVM.framework/Home/
    • path_to_key_sotre is $JAVA_HOME/lib/security/cacerts
    • certificate_file is where you store the downloaded certificate

    If prompted, the default truststore password is changeit.

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