zimazui

freedom & security


GnuPG

GnuPG

Source:

Create a key pair

$ gpg --full-gen-key --expert

List keys

$ gpg --list-keys
$ gpg --list-secret-keys

Export public key

$ gpg --export --armor --output public-key.asc user-id

Import public key

$ gpg --import public-key.asc

Encrypt and decrypt

Asymmetric

To encrypt a file (option -e / –encrypt) to recipient (-r / –recipient):

$ gpg --recipient user-id --encrypt doc

To decrypt a file (option -d / –decrypt):

$ gpg --output doc --decrypt doc.pgp

Tip:

  • Add --armor to encrypt a file using ASCII armor, suitable for copying and pasting a >message in text format
  • You can use your own user-id as recipient by using --default-recipient-self

Conclusion

Enjoy motherfucker! :D