This repository has been archived by the owner on Oct 25, 2018. It is now read-only.
forked from nyarly/simplekey
-
Notifications
You must be signed in to change notification settings - Fork 5
gnupg 2.0 Basic usage
Dashamir Hoxha edited this page May 31, 2016
·
3 revisions
Some basic usage is demonstrated on the examples below.
user@laptop:~$ rm -rf ~/.egpg/
user@laptop:~$ egpg
No directory '/home/user/.egpg'
Try first: egpg init
user@laptop:~$ egpg init
mkdir: created directory ‘/home/user/.egpg’
Appended the following lines to '/home/user/.bashrc':
---------------8<---------------
### start egpg config
export EGPG_DIR="/home/user/.egpg"
# Does ".gpg-agent-info" exist and points to gpg-agent process accepting signals?
if ! test -f "$EGPG_DIR/.gpg-agent-info" \
|| ! kill -0 $(cut -d: -f 2 "$EGPG_DIR/.gpg-agent-info") 2>/dev/null
then
gpg-agent --daemon --no-grab --quiet \
--options "$EGPG_DIR/gpg-agent.conf" \
--pinentry-program /usr/bin/pinentry \
--write-env-file "$EGPG_DIR/.gpg-agent-info" > /dev/null
fi
### end egpg config
--------------->8---------------
Please realod it to enable the new config:
source "/home/user/.bashrc"
user@laptop:~$ source "/home/user/.bashrc"
user@laptop:~$ egpg
EasyGnuPG v0.9 ( https://github.com/dashohoxha/egpg )
EGPG_DIR="/home/user/.egpg"
GNUPGHOME="/home/user/.egpg/.gnupg"
DONGLE=""
KEYSERVER="hkp://keys.gnupg.net"
GPG_AGENT_INFO="/tmp/gpg-05l0Kb/S.gpg-agent:13943:1"
GPG_TTY="/dev/pts/8"
SHARE=no
DEBUG=no
gpg: keyring `/home/user/.egpg/.gnupg/secring.gpg' created
gpg: keyring `/home/user/.egpg/.gnupg/pubring.gpg' created
gpg: /home/user/.egpg/.gnupg/trustdb.gpg: trustdb created
No valid key found.
Try first: egpg key gen
or: egpg key fetch
or: egpg key restore
or: egpg key recover
user@laptop:~$ egpg key gen [email protected] "Test User"
Creating a new key.
Enter passphrase for the new key:
Retype the passphrase of the key:
gpg: key 0D6282D1 marked as ultimately trusted
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2016-05-22
Excellent! You created a fresh GPG key. Here's what it looks like:
id: 4A8872C20D6282D1
uid: Test User <[email protected]>
fpr: 515B 8C7D 8106 0DC6 E6E8 F28F 4A88 72C2 0D62 82D1
trust: ultimate
cert: 4A8872C20D6282D1 2016-04-22 2016-05-22
auth: CEA9603E528CED7D 2016-04-22 2016-05-22
sign: 253F0000B8264D90 2016-04-22 2016-05-22
encr: A29A4814128F99FF 2016-04-22 2016-05-22
Creating a revocation certificate.
Revocation certificate saved at:
"/home/user/.egpg/4A8872C20D6282D1.revoke"
user@laptop:~$ egpg info
EasyGnuPG v0.9 ( https://github.com/dashohoxha/egpg )
EGPG_DIR="/home/user/.egpg"
GNUPGHOME="/home/user/.egpg/.gnupg"
DONGLE=""
KEYSERVER="hkp://keys.gnupg.net"
GPG_AGENT_INFO="/tmp/gpg-05l0Kb/S.gpg-agent:13943:1"
GPG_TTY="/dev/pts/8"
SHARE=no
DEBUG=no
id: 4A8872C20D6282D1
uid: Test User <[email protected]>
fpr: 515B 8C7D 8106 0DC6 E6E8 F28F 4A88 72C2 0D62 82D1
trust: ultimate
cert: 4A8872C20D6282D1 2016-04-22 2016-05-22
auth: CEA9603E528CED7D 2016-04-22 2016-05-22
sign: 253F0000B8264D90 2016-04-22 2016-05-22
encr: A29A4814128F99FF 2016-04-22 2016-05-22
user@laptop:~$ egpg key
id: 4A8872C20D6282D1
uid: Test User <[email protected]>
fpr: 515B 8C7D 8106 0DC6 E6E8 F28F 4A88 72C2 0D62 82D1
trust: ultimate
cert: 4A8872C20D6282D1 2016-04-22 2016-05-22
auth: CEA9603E528CED7D 2016-04-22 2016-05-22
sign: 253F0000B8264D90 2016-04-22 2016-05-22
encr: A29A4814128F99FF 2016-04-22 2016-05-22
user@laptop:~$ egpg key fpr
515B 8C7D 8106 0DC6 E6E8 F28F 4A88 72C2 0D62 82D1
user@laptop:~$ egpg key renew 1 year
id: 4A8872C20D6282D1
uid: Test User <[email protected]>
fpr: 515B 8C7D 8106 0DC6 E6E8 F28F 4A88 72C2 0D62 82D1
trust: ultimate
cert: 4A8872C20D6282D1 2016-04-22 2017-04-22
auth: CEA9603E528CED7D 2016-04-22 2017-04-22
sign: 253F0000B8264D90 2016-04-22 2017-04-22
encr: A29A4814128F99FF 2016-04-22 2017-04-22
user@laptop:~$ echo "This is a test message." > test.txt
user@laptop:~$ egpg seal test.txt
You need a passphrase to unlock the secret key for
user: "Test User <[email protected]>"
4096-bit RSA key, ID B8264D90, created 2016-04-22 (main key ID 0D6282D1)
user@laptop:~$ egpg open test.txt.sealed
user: "Test User <[email protected]>"
4096-bit RSA key, ID 128F99FF, created 2016-04-22 (main key ID 0D6282D1)
gpg: encrypted with 4096-bit RSA key, ID 128F99FF, created 2016-04-22
"Test User <[email protected]>"
gpg: Signature made Fri 22 Apr 2016 10:41:07 AM CEST using RSA key ID B8264D90
gpg: Good signature from "Test User <[email protected]>"
user@laptop:~$ egpg sign test.txt
You need a passphrase to unlock the secret key for
user: "Test User <[email protected]>"
4096-bit RSA key, ID B8264D90, created 2016-04-22 (main key ID 0D6282D1)
user@laptop:~$ egpg verify test.txt.signature
gpg: Signature made Fri 22 Apr 2016 10:42:34 AM CEST using RSA key ID B8264D90
gpg: Good signature from "Test User <[email protected]>"
user@laptop:~$ egpg key revoke
Revocation will make your current key useless. You'll need
to generate a new one. Are you sure about this? [y/N] y
gpg: key 0D6282D1: "Test User <[email protected]>" revocation certificate imported
gpg: Total number processed: 1
gpg: new key revocations: 1
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2017-04-22
user@laptop:~$ egpg key ls
No valid key found.
Try first: egpg key gen
or: egpg key fetch
or: egpg key restore
or: egpg key recover
user@laptop:~$ rm -rf ~/.egpg/