Created
November 5, 2020 18:22
-
-
Save hmarcelodn/65a343923e25065cf6644ad821dd6711 to your computer and use it in GitHub Desktop.
P12 Generator
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
#!/bin/bash | |
USERNAME=marcelo.delnegro | |
NAME=cert.staging.na01.northcountryfire.demandware.net | |
DAYS=36500 | |
# 0 - Navigate to P12 | |
cd ./STG-2FA-northcountryfire-00457696/ | |
# 1 - Generate Request | |
# openssl req -new -sha256 -newkey rsa:2048 -nodes -out <user>.req -keyout <user>.key | |
# ====================================================================== | |
# Country Name (2 letter code) [AU]: US | |
# State or Province Name (full name) [Some-State]: Massachusetts | |
# Locality Name (city) []: | |
# Organization Name (company) [Internet Widgits Pty Ltd]: B2C Commerce | |
# Organizational Unit Name (section) []: Customer Services | |
# Common Name (YOUR name) []: John Smith | |
# Email Address []: jsmith@salesforce.com | |
# Enter the following 'extra' attributes | |
# to be sent with your certificate request | |
# A challenge password []: | |
# An optional company name []: | |
# ====================================================================== | |
clear | |
ls | |
openssl req -new -sha256 -newkey rsa:2048 -nodes -out ${USERNAME}.req -keyout ${USERNAME}.key | |
# 2 - Sign the certificate request ( <user>.req) with your certificate | |
# ====================================================================== | |
# openssl x509 -CA cert.staging.web.customer.demandware.net_01.crt -CAkey cert.staging.web.customer.demandware.net_01.key | |
# -CAserial cert.staging.web.customer.demandware.net.srl -req -in jsmith.req -out jsmith.pem -days 10 | |
# ====================================================================== | |
clear | |
openssl x509 -CA ${NAME}_01.crt -CAkey ${NAME}_01.key -CAserial ${NAME}.srl -req -in ${USERNAME}.req -out ${USERNAME}.pem -days ${DAYS} | |
# 3 - Export the certificate and client information to pkcs12 format. | |
# ====================================================================== | |
# openssl pkcs12 -export -in jsmith.pem -inkey jsmith.key -certfile cert.staging.web.customer.demandware.net_01.crt -name "jsmith" -out jsmith.p12 | |
# ====================================================================== | |
# The system prompts for an export password for the file. | |
clear | |
openssl pkcs12 -export -in ${USERNAME}.pem -inkey ${USERNAME}.key -certfile ${NAME}_01.crt -name "${USERNAME}" -out ${USERNAME}.p12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment