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 Multiple keys
Divesh Uttamchandani edited this page Apr 23, 2018
·
3 revisions
EasyGnuPG does not allow more than one valid key (which is unexpired and unrevoked). What can you do if you need to use more than one private key? You can use different home directories for EGPG, one for each key, and they will not mess with each-other. Let's see an example of doing this.
testuser@laptop:~$ egpg init ~/.egpg1 <<< n
testuser@laptop:~$ egpg init ~/.egpg2 <<< n
testuser@laptop:~$ egpg init ~/.egpg <<< n
Now add these lines to ~/.bashrc
:
export EGPG_DIR="/home/testuser/.egpg1"
# 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
export EGPG_DIR="/home/testuser/.egpg2"
# 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
alias egpg1='EGPG_DIR="/home/testuser/.egpg1" egpg'
alias egpg2='EGPG_DIR="/home/testuser/.egpg2" egpg'
export EGPG_DIR="/home/testuser/.egpg"
testuser@laptop:~$ source ~/.bashrc
testuser@laptop:~$ egpg
EasyGnuPG 2.0-1.1 ( https://github.com/easygnupg/egpg )
EGPG_DIR="/home/testuser/.egpg"
GNUPGHOME="/home/testuser/.egpg/.gnupg"
DONGLE=""
KEYSERVER="hkp://keys.gnupg.net"
GPG_AGENT_INFO="/tmp/gpg-1OyoSv/S.gpg-agent:19657:1"
GPG_TTY="/dev/pts/8"
SHARE=no
DEBUG=no
No valid key found.
Try first: egpg key gen
or: egpg key fetch
or: egpg key restore
or: egpg key recover
testuser@laptop:~$ egpg1
EasyGnuPG 2.0-1.1 ( https://github.com/easygnupg/egpg )
EGPG_DIR="/home/testuser/.egpg1"
GNUPGHOME="/home/testuser/.egpg1/.gnupg"
DONGLE=""
KEYSERVER="hkp://keys.gnupg.net"
GPG_AGENT_INFO="/tmp/gpg-GzhOIA/S.gpg-agent:19661:1"
GPG_TTY="/dev/pts/8"
SHARE=no
DEBUG=no
No valid key found.
Try first: egpg key gen
or: egpg key fetch
or: egpg key restore
or: egpg key recover
testuser@laptop:~$ egpg2
EasyGnuPG 2.0-1.1 ( https://github.com/easygnupg/egpg )
EGPG_DIR="/home/testuser/.egpg2"
GNUPGHOME="/home/testuser/.egpg2/.gnupg"
DONGLE=""
KEYSERVER="hkp://keys.gnupg.net"
GPG_AGENT_INFO="/tmp/gpg-MMUdsA/S.gpg-agent:19663:1"
GPG_TTY="/dev/pts/8"
SHARE=no
DEBUG=no
No valid key found.
Try first: egpg key gen
or: egpg key fetch
or: egpg key restore
or: egpg key recover