简体   繁体   English

如何获取* .cer文件以将自签名HTTPS证书添加为Java信任

[英]How to get a *.cer file to add a self-signed HTTPS certificate as trusted for Java

I'm connecting to a HTTPS website with a self-signed certificate using a Java applet. 我正在使用Java applet连接到具有自签名证书的HTTPS网站。 The applet can't open the HTTPS connection - it returns the following exception: applet无法打开HTTPS连接 - 它返回以下异常:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

So the problem is that I need to add the certificate as "trusted" for Java. 所以问题是我需要将证书添加为Java的“可信”。 I read that I should use the following command: 我读到我应该使用以下命令:

keytool -import -alias abc -file ABCCA.cer

Am I correct? 我对么? How do I retrieve the *.cer file? 如何检索* .cer文件? The server is running Debian 5. I'm using Windows 7 and Java 6 on the client machine. 服务器正在运行Debian 5.我在客户端计算机上使用Windows 7和Java 6。

Connect to the https server with a browser and export the certificate. 使用浏览器连接到https服务器并导出证书。

With firefox is is done by double-clicking on the lock in the status bar, clicking on the button "View certificate", then in the "Details" tab, click on "Export..." 使用firefox是通过双击状态栏中的锁,单击“查看证书”按钮,然后在“详细信息”选项卡中单击“导出...”来完成的。

Follow below steps 按照以下步骤

1) In Chrome go to settings. 1)在Chrome中进入设置。
2) In Settings click show advance settings. 2)在“设置”中,单击“显示高级设置
3) Under HTTPS/SSL Click on Manage Certificates. 3)在HTTPS / SSL下单击“管理证书”。
4) Export Your Certificate. 4)导出您的证书。
5) In Windows searchs (Pressing windows key on keyboard) type java. 5)在Windows搜索中(按键盘上的Windows键)输入java。
6) Select (Configure Java) Option Which will open Java Control Panel 6)选择(配置Java)选项将打开Java控制面板
7) Select Security tab in Java Control Panel 7)在Java控制面板中选择安全选项卡
8) Select Manage Certificates 8)选择“管理证书”
9) Click Import 9)单击“导入”
10) Under (User) tab selected and certificate type as (Trusted Certificates) 10)在(用户)选项卡下选择,证书类型为(可信证书)
11) Click import button and browse to downloaded certificate and import it. 11)单击导入按钮,浏览到下载的证书并导入。

Done Enjoy. 完成享受。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM