encryption with gpg

Generate key

$ gpg --gen-key

List keys

$ gpg --list-keys

Encrypt Data

With a passprhare

$ gpg -ca -o output.txt.gpg input.txt

with a certificate and from STDOUT

$ gpg -ea

or if you know the name already (can be key, name or email)

$ gpg -ea -r "Ahmy"

Decrypt Data

$ gpg -d file.txt.gpg

Export

Public key

-a is to create armored ascii output.

Private Key

Import

Public key

Private Key

Deleting

Public Key

Private Key

Extend the expiration

Select the key to extend

Send key to a key server

Last updated

Was this helpful?