summaryrefslogtreecommitdiff
path: root/src/seckey2sshagent
diff options
context:
space:
mode:
authorMatt Goins <mjgoins@openflows.com>2008-06-20 14:23:41 -0400
committerMatt Goins <mjgoins@openflows.com>2008-06-20 14:23:41 -0400
commit3a6f611a52d56b919b8c50a6e1700af43ff49578 (patch)
tree1bbbb9fef2438c47c5801ea822099c97fabdcf6f /src/seckey2sshagent
parentb75cb97e42dd3327942d8b32cac2d9ee97e9aa4a (diff)
parent9efdaab59edb2ff4454082f6a36c9dc0d90b8885 (diff)
Merge branch 'master' of http://lair.fifthhorseman.net/~dkg/git/monkeysphere
Conflicts: gpg2ssh/Makefile
Diffstat (limited to 'src/seckey2sshagent')
-rwxr-xr-xsrc/seckey2sshagent40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/seckey2sshagent b/src/seckey2sshagent
new file mode 100755
index 0000000..d8e9b79
--- /dev/null
+++ b/src/seckey2sshagent
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# seckey2sshagent: this is a hack of a script to cope with the fact
+# that openpgp2ssh currently cannot support encrypted secret keys.
+
+# the basic operating principal is:
+
+# export the secret key in encrypted format to a new keyring
+
+# remove the passphrase in that keyring
+
+# use that keyring with openpgp2ssh
+
+# Authors: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
+# Jameson Rollins <jrollins@fifthhorseman.net>
+
+
+cleanup() {
+ echo -n "removing temp gpg home... "
+ rm -rf $FOO
+ echo "done."
+}
+
+trap cleanup EXIT
+
+GPGID="$1"
+
+idchars=$(echo $GPGID | wc -m)
+if [ "$idchars" -ne 17 ] ; then
+ echo "GPGID is not 16 characters ($idchars)."
+ exit 1
+fi
+
+FOO=$(mktemp -d)
+
+gpg --export-secret-key --export-options export-reset-subkey-passwd $GPGID | GNUPGHOME=$FOO gpg --import
+
+GNUPGHOME=$FOO gpg --edit-key $GPGID
+
+GNUPGHOME=$FOO gpg --export-secret-key $GPGID | openpgp2ssh $GPGID | ssh-add -c /dev/stdin