Encrypt and decrypt stuff with PGP - maggie1000/garden GitHub Wiki
Send and receive PGP encrypted messages.
Encrypt a message.
If you wish to send your husband a message claiming he has a cute butt, do this:
echo "you have a cute butt" | gpg -a --encrypt -r KEYID
This will stdout:
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.11 (Darwin)
hQIOA1dpYUvkq/uHEAgAsQx2Ev1jAVkO4jv+PpmdaA+EZSD6Bk47czvnAC5lTyt2
mmz2KxqGTOcp7KJUVZKAedllz2UOJhkeH5WMHqXouEMPXmfWJSNKojAgmHXTBpdK
sXKDquXsDIRfU1unSYOkBWBZU5wzYfaYwYWDyq8gWrF3ObSSrxW4vEyHtjYigi1H
YFbiEe9mDttgyBUwCrDeRLilE6683PFUoGm/ILYKjD3Jg8QfvvHrUzT9fnGue4De
NhG4GojaXi3SqNmuFxp/JpdF6IUuVjR3qhbBmB6nZasvY/RIyR3enbhyBuZFG91K
wv524Ye5Sj8cIiLvKT6PGD/qZqm6Bi/htVcXDWUY+QgA2cmCP2aFqFYagqEA/bIh
pWRk95VCEbI7lf7JDZXLmvlAejczA1XKkdLl2xWB2N98UIC3I6a2zuQJqbsDq89V
pVG9fbVZdXioYSuB8eAcNXpc77X3P2SPR4mmyG+/ipi4853uo4yINBrDA9bKj9cd
3m1OXH37sfHBHsclgymB+Gg58/QquMje+cZacJg8X7iQTqM8zd5oFPDbmSL0HTlX
wE+L54MLdPQ/tIHm8oCN3Rd+DYPLTuT8eJ98DZ8nMyhKJrSHoNYQ3kagpRih+cSJ
sI7pFFMyIjcwU3O6kVcdxiJTjyBI1H971yWLCMJ+FpZylfd8xUTTkpLMPPlKmgEy
6dJQATw2L3asoTBPuxr1ZQM6NciYGveNw9Z9tzEzWSTCyeFd+q0a9oRrjwjKdlDx
QtyCfwvRQph0oRgd5w2Fvxy29OUS+wVMtorJ/FzJl/YQlb8=
=D1DJ
-----END PGP MESSAGE-----
Only the person who has the private half of KEYID can now decrypt this.
You can send the resulting chunk via email. It's PGP - Pretty Good Privacy, better than plain-text email!
Encrypt a file
Similar to encrypting a message. If you want to encrypt my_file.txt:
gpg -a --encrypt -r KEYID my_file.txt
This will generate my_file.txt.asc which contains encrypted contents. You can send that along to the owner of the private half of KEYID.
Decrypting
gpg --decrypt my_file.txt.asc > output.txt
Your decrypted message is now in output.txt