Tuesday, September 6, 2011

Quick encryption with gpg

Today another kind of bookmark-style post;
Scenario:
You want to protect some file with a password to
  • store it on your local computer
  • send it to someone else.
You need the same password on both sides (=encryption and decryption).
(If sent to someone else, make sure to transfer the password on another way than the file.. )
  • encrypt:
    • % gpg --symetric foo.txt
      results in a file foo.txt.gpg which contains binary data
    • % gpg --symetric --armor foo.txt
      gives foo.txt.asc which contains ascii characters, which makes sense (for small files) when you want to paste it directly into an email
  • decrypt:
    • % gpg --output foo.txt --decode foo.txt.gpg
    • % gpg --output foo.txt --decode foo.txt.asc

source: http://advosys.ca/viewpoints/2006/07/pgp-symmetric-encryption/

No comments:

Post a Comment