keytool : 证书导入给出错误消息 - 密钥库被篡改或密码不正确

keytool : Certificate import gives error message - Keystore was tampered with, or password was incorrect(keytool : 证书导入给出错误消息 - 密钥库被篡改或密码不正确)

本文介绍了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

现在!

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

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 FilesJavajdk1.7.0_13jrelibsecuritycacerts"

错误

K:javacertificates>keytool -importcert -file usera.crt -keypass password -keystore "C:Program FilesJavajdk1.7.0_13jrelibsecuritycacerts"输入密钥库密码:keytool error: java.io.IOException: Keystore was tampered, or password is wrong

K:javacertificates>keytool -importcert -file usera.crt -keypass password -keystore "C:Program FilesJavajdk1.7.0_13jrelibsecuritycacerts" Enter keystore password: keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect

推荐答案

我已经解决了这个问题.我使用我的密码password"来更新 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 : 证书导入给出错误消息 - 密钥库被篡改或密码不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:keytool : 证书导入给出错误消息 - 密钥库被篡改或密码不正确

基础教程推荐