Last active
August 30, 2015 02:43
-
-
Save camsaul/738764c1575f59a1f9ef to your computer and use it in GitHub Desktop.
Self-Signed HTTPS
This file contains hidden or 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
#!/bin/bash | |
# PEM files are Base-64 format starting with -----BEGIN. Extensions: .pem, .crt, .cer, .key | |
# DER files are binary versions. Extensions: .der, .cer | |
# Keystores: | |
# PKSC7/P7B - Base64. Extensions: .p7b, .p7c | |
# PKCS12/PFX - Binary. Extensions: .pfx, .p12 | |
# Generate a new private key | |
openssl genrsa -out private.pem 2048 | |
# Generate CSR (Make sure to specify "Common Name" = "my-site.com") | |
openssl req -new -key private.pem -out CSR.csr | |
# Generate Certificate | |
openssl x509 -req -days 365 -in CSR.csr -signkey private.pem -out ssl.cer | |
# Generate a Public Key | |
# openssl rsa -in private.pem -pubout -out public.pem | |
# Upload to AWS | |
aws iam upload-server-certificate \ | |
--server-certificate-name my-aws-certificate \ | |
--certificate-body file:///path/to/ssl.cer \ | |
--private-key file:///path/to/private.pem | |
# Convert PEM Certificate to a DER | |
openssl x509 -outform der -in ssl.cer -out private.der | |
# Convert DER Certificate to PEM | |
openssl x509 -inform der -in apns.cer -outform pem -out apns.pem | |
# Convert PEM Certificate to P12 Keystore | |
openssl pkcs12 -export -in apns.pem -inkey private.pem -out bundle.p12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment