This little reference guide has examples that allow encryption/decryption and signature generation/verification with GnuPG.
Encryption
- To encrypt a file:
and the encrypted content of
$ gpg --encrypt file.txtfile.txtwill be on output filefile.txt.gpg. - ASCII armored encryption:
$ gpg --armor --encrypt file.txtfile.txt.ascwill contain the ASCII armored encryptedfile.txt. - To specify a recipient:
$ gpg --recipient rec - To specify the output file name:
Instead of the default
$ gpg --output fileout.gpg --encrypt file.txtfile.txt.asc, output tofileout.gpg. - To decrypt a file:
$ gpg --decrypt file.asc
Signatures
- To create a detached signature:
$ gpg --sign myfile.txtfile.txt.gpgwill be created with the binary signature. - To create a detached signature ASCII armored:
$ gpg --armor --sign myfile.txtfile.txt.gpgwill be created with the ASCII armored signature. - To create an attached signature:
$ gpg --clearsign myfile.txtfile.txt.gpgwill be created with both the message and the signature. - To verify a signature:
Verifies optional parameter
$ gpg --verify [sig.asc] myfile.txtsig.ascagainstmyfile.txt.
Revision History
Post built on: 2014-08-25 22:13:30
Last modified on: 2014-08-25 22:13:06
First published on: 2014-08-25
| Revision | Date | Description |
|---|---|---|
| 1.00 | 2014-08-25 | Initial Version. Published. |