keytool:证书导入提供错误消息 - 密钥库被篡改,或密码不正确 [英] keytool : Certificate import gives error message - Keystore was tampered with, or password was incorrect

查看:181
本文介绍了keytool:证书导入提供错误消息 - 密钥库被篡改,或密码不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是生成证书,将其导出到文件中并导入JDK密钥库。

第一步我生成了使用以下命令的自签名证书,为密钥库和密钥提供密码作为密码:

In first step I have generated a self signed certificate using following command, providing password as 'password' for keystore and key:

keytool   -genkeypair  -keystore .keystore  -alias uasera  -keyalg RSA

在第二步中,我使用类似的密码和以下命令导出证书:

In second step I exported the certificate using similar password and following command:

keytool  -exportcert  -keystore  .keystore  -alias usera  -file usera.crt

现在!

我正在尝试在cacerts中导入此证书在JDK中使用类似的密码和以下命令但获得异常。

I am trying to import this certificate in cacerts in JDK using similar password and following command but getting exception.

keytool -importcert -file usera.crt -keypass password  -keystore "C:\Program Files\Java\jdk1.7.0_13\jre\lib\security\cacerts"

错误

K:\ java \certificates> keytool -importcert -file usera.crt -keypass password - keystoreC:\Program Files\Java\jdk1.7.0_13\jre\lib\security\cacerts
输入密钥库密码:
keytool error:java.io.IOException :密钥库被篡改,或密码不正确

K:\java\certificates>keytool -importcert -file usera.crt -keypass password -keystore "C:\Program Files\Java\jdk1.7.0_13\jre\lib\security\cacerts" Enter keystore password: keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect

推荐答案

我已经解决了这个问题。我使用的是密码密码来更新JDK中的cacerts密钥库,而 cacerts密钥库的默认密码是changeit

I have got this sorted out. I was using my password that is 'password' to update cacerts keystore in JDK while default password for cacerts keystore is 'changeit'

这篇关于keytool:证书导入提供错误消息 - 密钥库被篡改,或密码不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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