summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2008-08-05 12:34:17 -0400
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2008-08-05 12:34:17 -0400
commit5c4044146eb0869129b39451599104075c9f6c82 (patch)
treed1bfee4e3bbc0121ae83bc9287d548588b50e611 /src
parentf34a3f7b13accbaba31789d0704ec6b6a43bedf1 (diff)
seckey2sshagent now adds keys with semantic alias including full OpenPGP fingerprint.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/seckey2sshagent15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/seckey2sshagent b/src/seckey2sshagent
index 8f3d54d..2a98cf1 100755
--- a/src/seckey2sshagent
+++ b/src/seckey2sshagent
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# seckey2sshagent: this is a hack of a script to cope with the fact
# that openpgp2ssh currently cannot support encrypted secret keys.
@@ -75,7 +75,7 @@ for GPGID in $GPGIDS; do
TMPPRIVATE=$(mktemp -d)
- gpg --export-secret-key $GPGID | GNUPGHOME="$TMPPRIVATE" gpg --import
+ gpg --export-secret-key "$GPGID" | GNUPGHOME="$TMPPRIVATE" gpg --import
# idea to script the password stuff. not working.
# read -s -p "enter gpg password: " PASSWD; echo
@@ -91,15 +91,16 @@ for GPGID in $GPGIDS; do
# )
# echo -e "$cmd" | GNUPGHOME="$TMPPRIVATE" gpg --command-fd 0 --edit-key $GPGID
- GNUPGHOME="$TMPPRIVATE" gpg --edit-key $GPGID
-
+ GNUPGHOME="$TMPPRIVATE" gpg --edit-key "$GPGID"
+
+ KEYNAME='MonkeySphere Key '$(echo "$GPGID" | tr -c -d '0-9a-fA-F')''
# creating this alias so the key is named "monkeysphere-key" in the
# comment stored by the agent, while never being written to disk in
# SSH form:
- ln -s /dev/stdin "$TMPPRIVATE"/monkeysphere-key
+ ln -s /dev/stdin "$TMPPRIVATE/$KEYNAME"
- GNUPGHOME="$TMPPRIVATE" gpg --export-secret-keys $GPGID | \
- openpgp2ssh $GPGID | (cd "$TMPPRIVATE" && ssh-add -c monkeysphere-key)
+ GNUPGHOME="$TMPPRIVATE" gpg --export-secret-keys "$GPGID" | \
+ openpgp2ssh $GPGID | (cd "$TMPPRIVATE" && ssh-add -c "$KEYNAME")
cleanup
done