viper25

Common GPG Commands

Aug 5th, 2014
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.28 KB | None | 0 0
  1. http://linux.101hacks.com/unix/gpg-command-examples/
  2.  
  3. #List GPG Keys
  4. gpg --list-public-keys
  5.  
  6. gpg --gen-key
  7. Username is samuel
  8.  
  9. #Export Key
  10. gpg --export -a "[email protected]" > public.key
  11. gpg --export-secret-key -a "[email protected]" > private.key
  12.  
  13. #Encrypt
  14. gpg --recipient samuel --encrypt file.txt
  15.  
  16. #Decrypt
  17. gpg --decrypt file.txt.gpg > file1.txt
  18.  
  19. 3Ec@lvgEim1*KaDp
  20.  
  21. #to export a private key:
  22. gpg --export-secret-key -a "samuel" > samuel_private.key
  23.  
  24. #to import a public key:
  25. gpg --import samuel_public.pub
  26. This adds the public key in the file "samuel_public.pub" to your public key ring.
  27.  
  28. #to import a private key:
  29. gpg --allow-secret-key-import --import samuel_private.key
  30. This adds the private key in the file "private.key" to your private key ring. There's a note (*) at the bottom explaining why you may want to do this.
  31.  
  32. #Revoke a Key
  33. gpg --gen-revoke <keyID>
  34.  
  35.  
  36. =========================
  37. OpenSSL
  38. http://rietta.com/blog/2012/01/27/openssl-generating-rsa-key-from-command/
  39. The generated files are base64-encoded encryption keys in plain text format.
  40.  
  41. Generate a 2048 bit RSA Key:
  42. openssl genrsa -des3 -out private.pem 2048
  43. mD4g^9B6gY7rMYh4
  44.  
  45. Export the RSA Public Key to a File:
  46. openssl rsa -in private.pem -outform PEM -pubout -out public.pem
Advertisement
Add Comment
Please, Sign In to add comment