akv31

GPG basics

Jan 12th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.23 KB | None | 0 0
  1. # ref: http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html
  2. # Create the keypair
  3. gpg --gen-key
  4.  
  5. # Create revocation key.
  6. gpg --gen-revoke -armor --output=revocationCertificate.asc me@mail.address
  7.  
  8. #export keys
  9. gpg --export -a "User Name" > public.key
  10. gpg --export-secret-key -a "User Name" > private.key
  11.  
  12. #send pub to keyserver
  13. gpg --keyserver keyserver.ubuntu.com --send-keys KEY-ID
  14.  
  15. # Import key from keyserver
  16. gpg --keyserver keyserver.ubuntu.com --recv 79986AB0
  17. gpg --list-keys
  18.  
  19. # List his fingerprint
  20. gpg --fingerprint he@mail.address
  21.  
  22. #sign his key
  23. gpg --sign-key he@mail.address
  24.  
  25. # list the signed key as ascii ( send it to him so that he can show to others signed by me )
  26. gpg --export --armor he@mail.address
  27.  
  28. #encrypt plain with his (he) pub key. This will generate plain.asc which can be send only to recipients
  29. #only those recipients can decrypt the message
  30. gpg --encrypt --sign --armor -r he@mail.address -r arunkumarv@cdac.in plain
  31.  
  32. #encrypt files
  33. gpg --encrypt filename #this will ask recipients. give me@address otherwise I cannot decrypt the message
  34. gpg --encrypt --sign -r me@myaddress.com filename
  35. gpg --output filename --decrypt filename.gpg
  36.  
  37. #decrypt files
  38. gpg filename
  39. gpg -d filename # just display
Add Comment
Please, Sign In to add comment