如何分离p12(或pfx)文件中的证书和私钥
2016-10-23 09:39
253 查看
p12(或者pfx)文件里一般存放有CA的根证书,用户证书和用户的私钥
假设我们有一个test.p12文件
在安装了openssl的linux服务器上执行以下命令:
提取用户证书:
如果需要携带秘钥,则去掉 -nokeys
提取私钥:
清除秘钥中的密码(在把秘钥部署到某些服务器上时可能需要清除密码)
在java中pkcs12 和jks的相互转换:
P12 → JKS
keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jks
假设我们有一个test.p12文件
在安装了openssl的linux服务器上执行以下命令:
提取用户证书:
openssl pkcs12 -in test.p12 -clcerts -nokeys -out cert.pem //pem格式 openssl pkcs12 -in test.p12 -clcerts -nokeys -out cert.crt //crt格式
如果需要携带秘钥,则去掉 -nokeys
openssl pkcs12 -in test.p12 -clcerts -out cert.pem //pem格式 openssl pkcs12 -in test.p12 -clcerts -out cert.crt //crt格式
提取私钥:
openssl pkcs12 -in test.p12 -nocerts -out key.pem
清除秘钥中的密码(在把秘钥部署到某些服务器上时可能需要清除密码)
openssl rsa -in key.pem -out newkey.pem
在java中pkcs12 和jks的相互转换:
JKS → P12 keytool -importkeystore -srckeystore keystore.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore keystore.p12
P12 → JKS
keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jks
相关文章推荐
- JAVA从一个.p12或.pfx文件中获取公钥和私钥
- java从 .pfx或.p12文件中获取公钥和私钥
- iOS_如何导出p12文件(开发/发布证书多台MAC使用技巧)
- iOS开发 - iOS_如何导出p12文件(开发/发布证书多台MAC使用技巧)
- 苹果p12文件--一个证书如何给多人使用
- Android之获取证书文件(pfx格式)的公钥和私钥
- 一个苹果证书如何多次使用 ---导出p12文件
- 一个苹果证书如何多次使用——导出p12文件
- 转:如何生成PFX证书文件,用于为S…
- 【IPhone开发】Apple Push Notification Service系列:整合私钥和证书,生成.p12文件
- 一个苹果证书如何多次使用——导出p12文件
- java处理加密文件---数字证书文件格式(cer和pfx)的区别
- 转 数字证书文件格式(cer和pfx)的区别
- 如何从一个 git repo 中分离出部分目录或文件至独立的 git repo
- java处理加密文件---数字证书文件格式(cer和pfx)的区别
- mac 钥匙串导入p12证书文件注意
- 如何用 openssl 生成RSA双密匙;签名证书;加密文件邮件
- 密钥对,公钥,证书,私钥,jks,keystore,truststore,cer,pfx名词说明
- iOS 证书/私钥/代码签名/描述文件
- 分离文件中 没有该如何定义样式表?