java.security.KeyStore 使用什么算法来加密 KeyStore.setKeyEntry() 和 KeyStore.store() 中的 privateKey?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3444898/
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
What algorithm does java.security.KeyStore use to encrypt the privateKey in KeyStore.setKeyEntry() and KeyStore.store()?
提问by pizzathehut
setKeyEntry() allows a password to protect a single private key, and store() allows a password to encrypt the entire keyStore. I'm using pkcs12 keystore type with the BC as the provider, and I can't figure out what it's using for encryption.
setKeyEntry() 允许使用密码来保护单个私钥,而 store() 允许使用密码来加密整个 keyStore。我使用 pkcs12 密钥库类型和 BC 作为提供者,我无法弄清楚它用于加密的内容。
Am I able to specify the kind of encryption used in these methods?
我能否指定这些方法中使用的加密类型?
回答by erickson
The KeyStoreimplementation depends on the type you request, and for some types, will depend on the provider as well.
该KeyStore实施取决于您所请求的类型,对于某些类型的,将取决于供应商也是如此。
If you are talking about the "JKS" type, you can find a description of the format and algorithms used here.
如果您谈论的是“JKS”类型,您可以在此处找到所用格式和算法的描述。
With a JKS key store, you cannot specify an encryption algorithm for private keys.
对于 JKS 密钥存储,您不能为私钥指定加密算法。
回答by President James K. Polk
It depends on which KeyStore provideryou are using.
这取决于您使用的是哪个KeyStore 提供程序。
The JCEKS provider uses PBEWithMD5AndTripleDES password-based encryption algorithm.
JCEKS 提供程序使用 PBEWithMD5AndTripleDES 基于密码的加密算法。

