-
-
Save ErliSoares/85752df4607b1c4936a1a61f44e3535e to your computer and use it in GitHub Desktop.
Generate pfx and cer certificates
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 Creation taken from https://github.com/Azure/azure-xplat-cli/wiki/Getting-Self-Signed-SSL-Certificates-(.pem-and-.pfx) | |
## PEM to CER (DER encoded) taken from http://stackoverflow.com/a/405545 | |
## PFX from PEM FIles taken from https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/ | |
# Install `openssl` package | |
# Generating a private key: | |
openssl genrsa 2048 > private_key.pem | |
# Generating the self signed certificate: | |
openssl req -x509 -days 7300 -new -config openssl.conf -key private_key.pem -out cert.pem | |
# Create PFX from PEM: | |
openssl pkcs12 -export -in cert.pem -inkey private_key.pem -out cert.pfx -password pass:123456 | |
# Obtain CER (DER-encoded) from PEM | |
openssl x509 -inform pem -in cert.pem -outform der -out cert.cer | |
# Check PFX certificate | |
#openssl pkcs12 -info -in cert.pfx | |
# Unify PEM Cert && PEM Key into a PFX file (or PKCS12 certificate) | |
openssl pkcs12 -export -out certificate.pfx -inkey private_key.pem -in cert.pem -password pass:123456 |
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
[req] | |
default_bits=2048 | |
default_md=sha256 | |
distinguished_name=req_subj | |
[req_subj] | |
commonName="Fully Qualified Domain Name (FQDN)" | |
commonName_default="Aegro:23706398000181" | |
emailAddress="Administrative Email Address" | |
emailAddress_default="aegro@aegro.com.br" | |
countryName="Country Name (2 letter code)" | |
countryName_default="BR" | |
stateOrProvinceName="State Name (full name)" | |
stateOrProvinceName_default="Rio Grande do Sul" | |
localityName="Locality Name (e.g., city)" | |
localityName_default="Porto Alegre" | |
organizationName="Organization Name (e.g., company)" | |
organizationName_default="Aegro Informatica Limitada" | |
organizationalUnitName="Organizational Unit Name (e.g., section)" | |
organizationalUnitName_default=AegroDev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment