Created
May 22, 2018 12:26
-
-
Save malys/13782641ac97b895939253888fd65d43 to your computer and use it in GitHub Desktop.
[OpenSSL] useful openssl command #openssl #googlepay
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
| # Life span certificate | |
| export DAYS=365 | |
| # Issuer | |
| export WHO=COMPANY | |
| # CSR file name (Copy CSR from Keystore to $CSR) | |
| export CSR=sample.csr | |
| echo "Reading CSR" | |
| openssl req -in $CSR -noout -text | |
| echo "Generate a Base64-encoded public key to provide to Google" | |
| openssl req -in $CSR -noout -pubkey | openssl pkey -pubin -noout -text | grep "pub:" -A5 | sed 1d | xxd -r -p | base64 | paste -sd "\0" - | |
| echo "Generate temporaly CA" | |
| openssl genrsa -out ca.key 2048 | |
| openssl req -new -x509 -key ca.key -out ca.crt -subj "//C=FR\ST=Haute-garonne\L=nLabège\O=$WHO\OU=nDevelopment\CN=googlepay" | |
| echo "Sign CSR and generate certificate for Keystore: userCertificate.crt" | |
| openssl x509 -days $DAYS -req -in $CSR -CA ca.crt -CAkey ca.key -CAcreateserial -out userCertificate.crt | |
| echo "Read Certificate" | |
| openssl x509 -in userCertificate.crt -noout -text | |
| echo "Copying to Clipboard (GIT bash only)" | |
| openssl x509 -in userCertificate.crt -noout -text | clip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment