How to convert .p12 to .crt file?

空扰寡人 提交于 2020-01-30 04:50:34

问题


Can anyone tell me the correct way/command to extract/convert the certificate .crt file from a .p12 file? After I searched. I found the way how to convert .pem to .crt. but not found .p12 to .crt.


回答1:


Try with given command

openssl pkcs12 -in filename.p12 -clcerts -nokeys -out filename.crt



回答2:


You tagged 'keytool'. If you mean Java keytool, which is not the only one, it can do this:

    keytool -keystore in.p12 -storetype pkcs12 -exportcert -file out.crt -rfc -alias $name
    # for java9 up omit -storetype pkcs12 -- it's now default
    # -rfc gives PEM form; omit for DER form
    # can omit -alias $name if 'friendlyname' is mykey -- 
    # but that's likely only for stores created _with_ keytool 
    # because other tools and users mostly don't use that name

(but personally I'd use openssl as in crack_it's answer).



来源:https://stackoverflow.com/questions/52980370/how-to-convert-p12-to-crt-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!