Last active
February 4, 2025 22:08
-
-
Save mergulhao/6269789 to your computer and use it in GitHub Desktop.
How to convert a PFX ssl certificate to PEM? If you are in Brazil and buy an A1 (e-CNPJ) certificate from CertSign it comes as a PFX. We need to convert it to PEM format so we can use the certificate to sign documents electronically and use it to access a lot of APIs, incluing NFe.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### pfx to pem, complete edition: | |
$ openssl pkcs12 -in filename.pfx -nocerts -out key.pem | |
$ openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem | |
$ openssl pkcs12 -in filename.pfx -cacerts -out ca_cert.pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Antes de rodar o comando é necessário escolher uma senha, de preferência um string com 120 caracteres randômicos. Essa senha é usada na geração do key e do ca_cert.
Para colocar o conteúdo de cada arquivo como variável de ambiente no Heroku usar esse trick:
http://stackoverflow.com/questions/6942600/multi-line-config-variables-in-heroku
http://stackoverflow.com/questions/2789319/file-content-into-unix-variable-with-newlines