Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【CA】Overview of Certificate Filetype & How to covert it with Openssl #73

Open
mylamour opened this issue Mar 21, 2020 · 0 comments
Open
Labels
学习 learning 总结 summary

Comments

@mylamour
Copy link
Owner

mylamour commented Mar 21, 2020

Overview of Cert filetype

  • PEM
    This is a (Privacy-enhanced Electronic Mail) Base64 encoded DER certificate, enclosed between “—–BEGIN CERTIFICATE—–” and “—–END CERTIFICATE—–“
    openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem

  • CER & CRT & DER
    Although usually in binary DER form, Base64-encoded certificates are also common (see .pem above).
    ``

  • P7B & P7C
    PKCS#7 SignedData structure without data, just certificate(s) or CRL(s)

  • P12
    PKCS#12 files may contain certificate(s) (public) and private keys (password protected).

  • PFX
    PFX is the predecessor of PKCS#12. This type of file usually contains data in PKCS#12 format (e.g., with PFX files generated in IIS).
    openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile more.crt

Openssl Tutorial & Cert Convert

OpenSSL Convert PEM

  • Convert PEM to DER
    openssl x509 -outform der -in certificate.pem -out certificate.der

  • Convert PEM to P7B
    openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer

  • Convert PEM to PFX
    openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

OpenSSL Convert DER

  • Convert DER to PEM
    openssl x509 -inform der -in certificate.cer -out certificate.pem

OpenSSL Convert P7B

  • Convert P7B to PEM
    openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

  • Convert P7B to PFX
    openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer
    openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CACert.cer

OpenSSL Convert PFX

  • Convert PFX to PEM
    openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes

Resources

@mylamour mylamour added 总结 summary 学习 learning labels Mar 21, 2020
@mylamour mylamour changed the title Overview of Certificate Filetype & How to covert it with Openssl 【CA】Overview of Certificate Filetype & How to covert it with Openssl Mar 21, 2020
@mylamour mylamour closed this as completed Apr 4, 2021
@mylamour mylamour reopened this Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
学习 learning 总结 summary
Projects
None yet
Development

No branches or pull requests

1 participant