Guest User

Untitled

a guest
May 26th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. # Life span certificate
  2. export DAYS=365
  3.  
  4. # Issuer
  5. export WHO=COMPANY
  6. # CSR file name (Copy CSR from Keystore to $CSR)
  7. export CSR=sample.csr
  8.  
  9. echo "Reading CSR"
  10. openssl req -in $CSR -noout -text
  11. echo "Generate a Base64-encoded public key to provide to Google"
  12. openssl req -in $CSR -noout -pubkey | openssl pkey -pubin -noout -text | grep "pub:" -A5 | sed 1d | xxd -r -p | base64 | paste -sd "\0" -
  13.  
  14.  
  15. echo "Generate temporaly CA"
  16. openssl genrsa -out ca.key 2048
  17. 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"
  18.  
  19. echo "Sign CSR and generate certificate for Keystore: userCertificate.crt"
  20. openssl x509 -days $DAYS -req -in $CSR -CA ca.crt -CAkey ca.key -CAcreateserial -out userCertificate.crt
  21.  
  22. echo "Read Certificate"
  23. openssl x509 -in userCertificate.crt -noout -text
  24. echo "Copying to Clipboard (GIT bash only)"
  25. openssl x509 -in userCertificate.crt -noout -text | clip
Add Comment
Please, Sign In to add comment