使用基于 Java Key Store 中的别名的单个证书
我有一个密钥库,其中添加了多个密钥和证书我想使用基于密钥库中别名的证书并将其用于 SSL我尝试设置以下系统属性,但没有任何帮助
I have a keystore which has multiple keys and certificates added to it I want to used a certificate based on the aliases from the key store and use it for SSL I tried to set the following System properties but nothing helped
System.setProperty("javax.net.ssl.keyAlias", "abcd");
System.setProperty("javax.net.ssl.keyStoreAlias", "abcd");
它总是使用密钥库中的第一个证书,而不是匹配密钥别名
It always uses the first certificate from the keystore instead of matching the key aliases
推荐答案
如果你看看 JSSE 参考指南的自定义部分(或整个指南),没有 javax.net.ssl.keyAlias
或 javax.net.ssl.keyStoreAlias
属性.
If you look at the Customization section of the JSSE Reference Guide (or the entire guide), there's no javax.net.ssl.keyAlias
or javax.net.ssl.keyStoreAlias
property.
应用程序可以使用别名来选择它想要的证书,但它必须自己显式加载它.一些框架使用自己的属性或配置选项.
It's up to the application to have a way to select which certificate it wants, using its alias name, but it has to load it explicitly itself. Some frameworks use their own properties or configuration options.
相关文章