diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2008-06-17 14:52:31 -0400 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2008-06-17 14:52:31 -0400 |
commit | 9c94e937fbe8beb56956365cac07d6eff45215cd (patch) | |
tree | 11d9060e75580752bd79adb353e0d706c513a830 /src/seckey2sshagent | |
parent | 92c70306aa5f96c8dfa69f2c90dca58908e719f7 (diff) | |
parent | ac63e6d6a916e4b51a183e60d7aeae3c2568f3af (diff) |
Merge commit 'jrollins/master'
Diffstat (limited to 'src/seckey2sshagent')
-rwxr-xr-x | src/seckey2sshagent | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/seckey2sshagent b/src/seckey2sshagent new file mode 100755 index 0000000..0e8d695 --- /dev/null +++ b/src/seckey2sshagent @@ -0,0 +1,25 @@ +#!/bin/sh + +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 |