2014/08/25

GnuPG Encryption and Signature Reference Guide

This little reference guide has examples that allow encryption/decryption and signature generation/verification with GnuPG.

Encryption

  • To encrypt a file:

    $ gpg --encrypt file.txt
    

    and the encrypted content of file.txt will be on output file file.txt.gpg.

  • ASCII armored encryption:

    $ gpg --armor --encrypt file.txt
    

    file.txt.asc will contain the ASCII armored encrypted file.txt.

  • To specify a recipient:

    $ gpg --recipient rec
    

  • To specify the output file name:

    $ gpg --output fileout.gpg --encrypt file.txt
    

    Instead of the default file.txt.asc, output to fileout.gpg.

  • To decrypt a file:

    $ gpg --decrypt file.asc
    

Signatures

  • To create a detached signature:

    $ gpg --sign myfile.txt
    

    file.txt.gpg will be created with the binary signature.

  • To create a detached signature ASCII armored:

    $ gpg --armor --sign myfile.txt
    

    file.txt.gpg will be created with the ASCII armored signature.

  • To create an attached signature:

    $ gpg --clearsign myfile.txt
    

    file.txt.gpg will be created with both the message and the signature.

  • To verify a signature:

    $ gpg --verify [sig.asc] myfile.txt
    

    Verifies optional parameter sig.asc against myfile.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.

No comments :

Post a Comment