我有一个包含多个证书的
.pfx
文件,其中一个是分配给 DCM 中 IBM i 远程命令服务器的服务器证书的签名 CA 证书。
我设法使用
openssl
和certutil
来显示这样一个证书的内容,如下:
openssl x509 -passin pass:<password> -text -noout -in filename.pfx
openssl pkcs12 -in filename.pfx -passin pass:<password> -info -nokeys
certutil -v -dump DEVP20.pfx
以上所有内容都工作正常并显示内容,但问题是我不知道如何分析这样的输出。
此外,
keytool
报告梯形校正中没有条目:
keytool -list -v -keystore filename.pfx
Enter keystore password: <entery-password>
Keystore type: PKCS12
Keystore provider: SunJSSE
Your keystore contains 0 entries
我想要的只是创建一个新的信任存储或使用现有的信任存储(例如
jssecacerts
)将签名 CA 证书添加到信任存储中。
请注意,在上面不同命令的输出中,我看到多个证书。我不确定它们是否是链的一部分或相关的,通过检查别名或友好名称,我可以知道我想要哪一个。
目标是能够使用 IBM Toolbox for Java 中的类
SecureAS400
打开与 IBM i 的安全连接并调用命令。所以我们必须使用 JVM 加载信任存储。
感谢您的帮助。
首先,您必须使用 openssl 从 .pfx 文件中提取 CA 证书:
openssl pkcs12 -in filename.pfx -passin pass:<password> -info -nokeys > filename.pem
。openssl x509 -in test.pem -noout -text
然后使用密钥工具创建新的 JKS:
keytool -import -trustcacerts -keystore test.jks -storepass choose-password -file test.pem -alias CANAME
或者您可以将证书导入到现有的信任存储中:
keytool -import -keystore cacerts -storepass changeit -file test.pem -alias CANAME -storetype JKS
通常您会使用 openssl 与大多数证书文件格式交互,并且
keytool
仅与 java 密钥存储 (JKS) 交互
如果有效请回复