Monday, October 26, 2009

How to encrypt a file using GPG/GnuPG

Encrypting a file is easy, you'll need the name you used above (which I told you to remember). Issue the command below:

Code:
# gpg -e -r  
Which you will need to replace and with valid values. Let us use the name I used, tor, and /home/tor/test.txt as the file name.

Code:
# gpg -e -r tor /home/tor/test.txt
Alternatively you can use the long version of the command:

Code:
# gpg --encrypt --recipient 'tor' /home/tor/test.txt
Here is the file before encryption:

Code:
this is a test
and here is the file after encryption:

Code:
<85>^B^N^CeK^Z^MÂó ?l|[- !S>Ã<91><9f>Mo9âg²ê^?#Y ^XôÃ]ëF$f¿a^WCô^Uqøh"v^]Ã:§`^Nÿ Ã^\Ã

ðïe°¾Ã¹Ã*G/j>^Y<95>½UI<9f>d^F<83>÷@Ã<89>^U;Ã(o^VCAÃHÃ¥?<9c>U~ü<86>w;ZXÃ>§¥ÃL[º² ag^[^[^] k^HC<8b>^A<98>^P<86>^GFZÃöE<9f>ÿl'+<9b>+3 Ã(Ã<8a>î±ÃÃ86>> þ^ZÿãWÃ<85>^[^?^K<82>Ã>KÃ4^RZE--xS^E£OlÃÃÃ
FöÃ*<9e>¹».~S{Ãf<855ã>M|M^Hºy¼?^\|S:[Ãì<8b>çl<94>*b}<93>éÃ7K´<92>î¨*Ã>¶!¯ÃC0´D<95>>
D^PÃh<9d>ÃÃöBÃ^U$^_<89>´é^Cô4þÃÃ
<83>^X©^Tøà ¶£=<8b>aYüö¢^YóiTut<8e>^^ VA<8a>|Ãâ<95>§S7¢¢ýGO%T*tÃ<81>Ã=ê^]¿/ôCÿÃhKóL^AÃô]?^NÃ=<8e>!Ãþ¼G^MVg>ð<8e>^]<9a>)Ãà Ã<84>»KÃ<96>8ÃÃ^C^Olú÷© LÃñªÃ^A^VÃ(^E<94>Ã^?mÃþF?Ã<90>qÃ>^^p^@^^
\|9<84>¢6<8d>^VðgäùÃ<8e>µéuÃã<90><8c>^R^X! <9d><90>^\ïñQ<94>yty>F]¹2Ã^XmìK<9d>:kT
GPG will add a ".gpg" to the end of the encrypted file. This leaves the original intact and makes an encrypted copy.

Enjoy ubuntu... ;)

No comments:

kunkun-laptop .... ;)