我在本地机器上生成证书时出现以下错误。

C:\Users\abc>keytool -genkey -alias tomcat -keyalg RSA
Enter keystore password:
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect

我认为jdk版本有一些问题。我在我同事的机器上运行了同样的命令,它工作得很好。

请分享你的意见。


当前回答

你有两个选择:

CMD在输入时不会在屏幕上显示密码 所以只要输入正确的密码——小心点——然后按回车。

或 只使用:

keytool -list -keystore 'keystoreName' -storepass 'type your keystore passwd'

对于Keys的完整信息,添加-v:

keytool -v -list -keystore 'keystoreName' -storepass 'type your keystore passwd'

其他回答

在我的情况下,我需要有根访问权限。

在tomcat 8.5中注意写正确的属性名。这是我在server.xml上的代码:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" SSLEnabled="true">
    <SSLHostConfig>
        <Certificate certificateKeystoreFile="conf/keystore" certificateKeystorePassword="mypassword" type="RSA"/>
    </SSLHostConfig>
</Connector>

您可以访问https://tomcat.apache.org/tomcat-8.5-doc/config/http.html查看所有属性

在我使用Xamarin Forms 4.7和Visual Studio 2019 16.7.0 Preview 3.1的情况下,问题是最近更新的Android构建工具(apksigner)和JDK的版本不匹配。更新JDK到最新,并将新的JDK路径指向Tools->Options->Xamarin->Android Settings,并且它可以工作。

在我的Mac上,空密码是可行的

keytool -list -v -keystore ~/.android/debug.keystore 

按回车键,就会显示出来

Enter keystore password:  

在这里,只要按Enter键就可以获得空密码

 [root@localhost Certificate]# openssl pkcs12 -export -in 
 /opt/Certificate/115c99f4c5aa98f5.crt -inkey /opt/Certificate/ravi.in.key -certfile 
/opt/Certificate/gd_bundle-g2-g1.crt -out RaviNew.p12

Enter Export Password: <Password>
Verifying - Enter Export Password: <Password>

注意:-上面导出密码写下来的任何地方,因为它是必须创建JKS文件(这是取决于你的选择什么密码你想做)

  keytool -importkeystore -srckeystore DigiEduNew.p12 -srcstoretype pkcs12 -destkeystore finaldigiEdu.jks -deststoretype JKS
  Importing keystore DigiEduNew.p12 to finaldigiEdu.jks...
  Enter destination keystore password: <Any Password >
  Re-enter new password: <Any Password >
  Enter source keystore password: <.P12 Password >
  Entry for alias 1 successfully imported.
  Import command completed:  1 entries successfully imported, 0 entries failed or 
  cancelled



 Warning:
 The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 
 which is an industry standard format using "keytool -importkeystore -srckeystore 
 finaldigiEdu.jks -destkeystore finaldigiEdu.jks -deststoretype pkcs12".