通过java keytool导入证书

时间:2015-12-26 10:12:59

标签: java import certificate keystore keytool

我使用Java keytool,我想做一些简单的事情,但在第五步后出现问题。这里有什么问题?

  1. Side" A"创建公钥和私钥:

    keytool -genkeypair -alias AStore -keyalg RSA -keysize 2048 -sigalg SHA256withRSA -dname -keypass Aaa123 -validity 90 -storetype JCEKS -keystore D:\ keystore \ A \ keystore.jceks -storepass Aaa123

  2. Side" B"创建公钥和私钥:

    keytool -genkeypair -alias BStore -keyalg RSA -keysize 2048 -sigalg SHA256withRSA -dname -keypass Bbb123 -validity 90 -storetype JCEKS -keystore D:\ keystore \ B \ keystore.jceks -storepass Bbb123

  3. Side" A"出口他的证书:

    keytool -exportcert -alias AStore -file D:\ keystore \ A.cer -keystore D:\ keystore \ A \ keystore.jceks -storetype JCEKS

  4. Side" B"出口他的证书:

    keytool -exportcert -alias BStore -file D:\ keystore \ B.cer -keystore D:\ keystore \ B \ keystore.jceks -storetype JCEKS

  5. Side" A"进口证书" B":

    keytool -importcert -alias AStore -file D:\ keystore \ B.cer -keystore D:\ keystore \ A \ keystore.jceks -storetype JCEKS

  6. 我收到错误:

    > keytool错误:java.lang.Exception:回复中的公钥和密钥库不匹配

0 个答案:

没有答案