generate_keys 648 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. set -e
  3. for file in "dsaparam.pem" "dsa_priv.pem" "dsa_pub.pem"; do
  4. if [ -e "$file" ]; then
  5. echo "There's already a $file here! Move it aside or be more careful!"
  6. exit 1
  7. fi
  8. done
  9. openssl="/usr/bin/openssl"
  10. $openssl gendsa <($openssl dsaparam 4096) -out dsa_priv.pem
  11. chmod 0400 dsa_priv.pem
  12. $openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem
  13. echo "
  14. Generated two files:
  15. dsa_priv.pem: your private key. Keep it secret and don't share it!
  16. dsa_pub.pem: public counterpart to include in the app bundle.
  17. BACK UP YOUR PRIVATE KEY AND KEEP IT SAFE!
  18. If you lose it, your users will be unable to upgrade!
  19. "
  20. open -R dsa_priv.pem