将SSL证书添加到JRE以访问HTTPS站点 [英] Adding an SSL Certificate to JRE in order to access HTTPS sites

查看:189
本文介绍了将SSL证书添加到JRE以访问HTTPS站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文:

所以我试图从我的Java代码访问HTTPS站点,但由于SSL,我无法访问我的localhost和服务器之间的握手问题。这个问题的原因似乎是我尝试访问的URL没有从授权CA颁发的有效证书。

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 server. It seems the reason for this issues is that the URL I am trying to access has no valid certificate issued from an authorized CA.

因此,经过一些研究,我将尝试将有问题的SSL证书导入我的JRE,这样就可以验证它。

So after some research, I'm going to try to import the offending SSL certificates into my JRE, that way it can be validated.

问题:

使用keytool的此命令的mac等价物是什么用于导入证书:

What is the mac equivalent of this command using the keytool for importing certificates:

keytool -import -alias mycertificate -keystore ..\lib\security\cacerts -file c:\mycert.cer

参考:

http:/ /www.jyothis.co.in/2011/11/12/javax-net-ssl-sslhandshakeexception/

非常感谢任何帮助或帮助,谢谢

Any help or assistance would be much appreciated, thank you

推荐答案

您应该能够使用命令将服务器(自签名?)SSL证书导入localhost你指定了。为了更完整,你可以尝试

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 

其中


  • $ JAVA_HOME 是 /System/Library/Frameworks/JavaVM.framework/Home /

  • path_to_key_sotre $ JAVA_HOME / lib / security / cacerts

  • certificate_file 是存储下载证书的地方

  • $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

如果出现提示,默认信任库密码为 changeit

If prompted, the default truststore password is changeit.

这篇关于将SSL证书添加到JRE以访问HTTPS站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆