导入证书后Java Keytool错误,"keytool error: java.io.FileNotFoundException &访问被拒绝" [英] Java Keytool error after importing certificate , "keytool error: java.io.FileNotFoundException & Access Denied"

查看:49
本文介绍了导入证书后Java Keytool错误,"keytool error: java.io.FileNotFoundException &访问被拒绝"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 HTTPS 连接 Java Web API;但是,抛出异常:

I'm trying to connect a Java Web API via HTTPS; however, an exception is thrown:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException

我遵循了从在线 keytool & 中学到的这些步骤SSL证书教程:

I followed these steps which I learned from online keytool & SSL cert tutorials:

  1. 我将 HTTPS URL 复制到浏览器中,下载了 SSL 证书 &使用 Internet Explorer 在浏览器中安装它们.

  1. I copied the HTTPS URL into the browser, downloaded the SSL certificates & Installed them in the browser using Internet Explorer.

将证书导出到我电脑上的某个路径,证书保存为.cer

Exported the certificates to a path on my computer, the certificates were saved as .cer

使用了 keytool 的导入选项.下面的命令执行没有任何错误.

Used the keytool's import option. The command below executed without any errors.

keytool -import -alias downloadedCertAlias -keystore C:path	omykeystorecacerts.file -file C:pathofexportedCert.cer

  • 我在命令提示符下被提示输入密码,我输入了密码,然后我通过了身份验证.

  • I was prompted for a password at the command prompt, which I entered then I was authenticated.

    cmd 窗口打印了一些证书数据 &签名,我被提示了一个问题:

    The cmd window printed some certificate data & signatures and I was prompted with the question:

    信任这个证书?

    我回答是.

    显示的cmd提示

    证书已添加到密钥库

    但是在该消息之后,显示了另一个异常:

    However after that message, another exception was displayed:

    keytool error: java.io.FileNotFoundException: C:Program files...cacerts <Access Denied>
    

  • 最后,当我检查 keystore 时,没有添加 SSL 证书,我的应用程序给出了我之前尝试连接时遇到的相同异常:

    Finally when I checked the keystore , the SSL certificate was not added and my application gives the same exception I was getting earlier when trying to connect:

    (javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException)
    

    推荐答案

    如果您没有在管理员模式下运行命令提示符,则可能会发生这种情况.如果您使用的是 Windows 7,则可以运行,输入 cmd 并按 Ctrl+Shift+Enter.这将以管理员模式打开命令提示符.如果没有,您也可以转到开始->所有程序->附件->右键单击命令提示符并单击以管理员身份运行".

    This could happen if you are not running the command prompt in administrator mode. If you are using windows 7, you can go to run, type cmd and hit Ctrl+Shift+enter. This will open the command prompt in administrator mode. If not, you can also go to start -> all programs -> accessories -> right click command prompt and click 'run as administrator'.

    这篇关于导入证书后Java Keytool错误,&quot;keytool error: java.io.FileNotFoundException &amp;访问被拒绝"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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