Giter VIP home page Giter VIP logo

gpg-cheat-sheet's Introduction

GPG Cheat Sheet

A list of common GPG commands.

Install

Using Homebrew

brew install gnupg

Commands

Setup & Key Management

Create GPG key

gpg --gen-key

Export your public key

gpg --export --armor [optional email or name?] > publickey.asc

Import another person's public key

gpg --import theirpublickey.asc

List the public keys in your keyring

gpg --list-keys

List the private keys in your keyring

gpg --list-secret-keys

Trust a public key

gpg --edit-key [email or username]

trust (invoke trust command on the key)
5 (ultimate trust)
y (if prompted)
quit

Encryption & Decryption

Encrypt a file

gpg --encrypt --recipient [email or username] [filename.txt]

If you want to encrypt a file so that only you can decrypt it, then specify yourself as the email or username:

gpg --encrypt --recipient [your username or email] [filename.txt]

If you want to encrypt a file so that only a group can decrypt it, define the group in your gpg.conf file (see below) and then specify that group in the recipient parameter:

gpg --encrypt --recipient [group name] [filename.txt]

And the shortened version of these commands:

gpg -e -r [recipient] [filename.txt]

Decrypt a file to terminal

gpg --decrypt [filename.txt]

Omit --decrypt if the file is a binary file.

Decrypt a file to disk

gpg [filename.txt.gpg]

Signing and Verifying Signatures

Sign a file & output in binary format

gpg --output output.txt --sign doc.txt

Sign a file & output with clearsign

gpg --clearsign doc.txt

Sign a file & detach its signature

gpg --output output.txt --detach-sig doc.txt

Decrypt and verify signature

gpg --output output.txt --decrypt signed.sig

Verify signature

gpg --verify signed.txt

Verify with detached signature

gpg --verify doc.sig doc.txt

GPG Agent usage

The GPG agent will act as a cache for your private key. It's a daemon that runs on your machine in the background. Should be started as a system service during boot.

To interact with the agent there is the command gpg-connect-agent. That opens a command line interface like Telnet to the agent where you can issue commands and the agent will answer.

List currently loaded keys

gpg-connect-agent 'keyinfo --list' /bye

Configuration

Create groups of people in your configuration file

GPG software configuration is stored in your home directory at ~/.gnupg/gpg.conf.

You list the members of a group by some attribute of their public key found in your GPG keyring; this is typically a person's name or email address (or partials of either of these).

group spies = nick, steve, chris

Sources

http://blog.ghostinthemachines.com/2015/03/01/how-to-use-gpg-command-line/ https://www.gnupg.org/gph/en/manual/x135.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.