From: Daniel Kahn Gillmor Date: Tue, 5 Aug 2008 16:34:17 +0000 (-0400) Subject: seckey2sshagent now adds keys with semantic alias including full OpenPGP fingerprint. X-Git-Tag: monkeysphere_0.8-1~63^2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5c4044146eb0869129b39451599104075c9f6c82;p=monkeysphere.git seckey2sshagent now adds keys with semantic alias including full OpenPGP fingerprint. --- 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