密钥工具错误:java.security.KeyStoreException:未找到 BKS

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6866447/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 17:38:33  来源:igfitidea点击:

keytool error: java.security.KeyStoreException: BKS not found

javakeystore

提问by Qaiser Mehmood

how to create a .bks keystore in java sun keytool, what should i do?

如何在 java sun keytool 中创建 .bks 密钥库,我该怎么办?

C:\Program Files\Java\jdk1.6.0\jre\bin>keytool -genkey -alias server3private -ke
ystore server3.private -storetype BKS -keyalg rsa -dname "CN=Your Name, OU=Your
Organizational Unit, O=Your Organization, L=Your City, S=Your State, C=Your Coun
try" -storepass tahirpw -keypass tahirpw

it gives me error

它给了我错误

keytool error: java.security.KeyStoreException: BKS not found

密钥工具错误:java.security.KeyStoreException:未找到 BKS

回答by Jcs

Your error indicates that keytooltries to instantiate a BKSkeystore but no Cryptographic Service Provider(CSP) is able to provide such an implementation. BKSkeystore type is a type implemented by the BouncyCastle CSP.

您的错误表明keytool尝试实例化BKS密钥库,但没有加密服务提供程序(CSP) 能够提供这样的实现。BKS密钥库类型是由BouncyCastle CSP实现的类型。

Therefore there is 2 solutions:

因此有2个解决方案:

  1. install this provider with Java. Oracle published along with Java a comprehensive documentation.

  2. pass to keytool the suitable options to indicate which CSP should be used and its location:

  1. 使用 Java 安装此提供程序。Oracle 随 Java 一起发布了一份综合文档

  2. 将合适的选项传递给 keytool 以指示应使用哪个 CSP 及其位置:

-storetype BKS                                               <- keystore type
-provider org.bouncycastle.jce.provider.BouncyCastleProvider <- CSP implementation
-providerpath /path/to/bouncycastle.jar                      <- Path to the CSP jar file
-storetype BKS                                               <- keystore type
-provider org.bouncycastle.jce.provider.BouncyCastleProvider <- CSP implementation
-providerpath /path/to/bouncycastle.jar                      <- Path to the CSP jar file