Advertisement
Guest User

gpg-gen.sh

a guest
Jul 4th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.81 KB | None | 0 0
  1. #!/bin/bash
  2. GPG_BIN="/usr/bin/gpg"
  3. GPG_CMD="--gen-key --no-use-agent"
  4. EXPECT_CMD="/usr/bin/expect"
  5.  
  6. #### GPG Paam ###
  7. GPG_NAME="Demo Name"
  8. GPG_EMAIL="demo@mail.com"
  9. GPG_PASSPHASE="aaa"
  10.  
  11.  
  12. EXPECT_STR=$($EXPECT_CMD -c "
  13.  
  14. spawn $GPG_BIN $GPG_CMD
  15.  
  16. expect \"Your selection?\"
  17. send \"1\r\"
  18.  
  19. expect \"What keysize do you want?\"
  20. send \"2048\r\"
  21.  
  22. expect \"Key is valid for?\"
  23. send \"365\r\"
  24.  
  25. expect \"Is this correct?\"
  26. send \"y\r\"
  27.  
  28. expect \"Real name:\"
  29. send \"$GPG_NAME\r\"
  30.  
  31. expect \"Email address:\"
  32. send \"$GPG_EMAIL\r\"
  33.  
  34. expect \"Comment:\"
  35. send \"$GPG_COMMENT\r\"
  36.  
  37. expect \"Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?\"
  38. send \"O\r\"
  39.  
  40. expect \"Enter passphrase:\"
  41. send \"$GPG_PASSPHASE\r\"
  42.  
  43. expect \"Repeat passphrase:\"
  44. send \"$GPG_PASSPHASE\r\"
  45.  
  46. expect eof
  47. ")
  48.  
  49. echo "$EXPECT_STR"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement