JKS和PKCS12格式

JKS (Java Keystore) is a Java-specific file format that was the default format for KeyStores until Java 8. Starting from Java 9, PKCS#12 is the default KeyStore format. Despite JKS, PKCS#12 is a standardized and language-neutral format for storing encrypted data. The PKCS#12 format is also known as PKCS12 or PFX.

PEM (Privacy Enhanced Mail) is also a certificate container format. The PEM files are encoded in Base64. This ensures that data remains intact during translation between different systems.

Further, a PEM file can contain one or more instances, each of them being separated by a plain-text header and footer:

openssl pkcs12 -in test.p12 -nocerts -nodes -out rsa_origin.key
openssl rsa -in rsa_origin.key -out rsa_pkcs1.pem
openssl rsa -in rsa_origin.key -pubout -out rsa_public_key.pem
openssl pkcs8 -topk8 -inform PEM -in rsa_pkcs1.pem -outform PEM -out rsa_private_pkcs8.pem -nocrypt

将jks文件转未pkcs12格式

keytool -importkeystore -srckeystore client.jks -destkeystore client.pkcs 
 -srcstoretype JKS -deststoretype PKCS12

将pkcs12格式转化为pem文件

openssl pkcs12 -clcerts -nokeys -in test.p12 -out cert.pem
openssl pkcs12 -clcerts -nokeys -out cert.pem -in test.p12
openssl pkcs12 -export -in cert.pem -inkey key.pem -out certificate.p12 -name "certificate"

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 达视天津3月26日天气情况 朋友们,大家早上好!今天是2023年3月26日星期日,农历闰二月初五;当前时间是4:1...
    余則徐阅读 118评论 0 1
  • 1、你人生最大的任务还是学习、探索和行动。 —— 梁永安 2、旧人不知我近况,新人不知我过往;近况不该旧人知,过往...
    执剑饮烈酒阅读 209评论 0 2
  • 书中提到的名人及相关书籍或文章 1.张文质主编《教师怎样教育自己的子女》 2.苏联教育家马卡连柯特别强调父母的示范...
    一朵小红花呀阅读 336评论 0 0
  • 二十一世纪旧体诗词风骚榜[https://www.jianshu.com/c/da968ae2d498] 上榜絮语...
    张成昱阅读 272评论 0 14
  • [TOC] 一级标题 二级标题 五级标题 列表fm8.jpg第一项 列表第二项 有序列表第一项 有序列表第二项标题...
    sean1810阅读 61评论 0 0