add some things to the TODO
[monkeysphere.git] / src / seckey2sshagent
1 #!/bin/sh
2
3 # seckey2sshagent: this is a hack of a script to cope with the fact
4 # that openpgp2ssh currently cannot support encrypted secret keys.
5
6 # the basic operating principal is: 
7
8 # export the secret key in encrypted format to a new keyring
9
10 # remove the passphrase in that keyring
11
12 # use that keyring with openpgp2ssh
13
14 # Authors: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
15 #          Jameson Rollins <jrollins@fifthhorseman.net>
16
17
18 cleanup() {
19     echo -n "removing temp gpg home... "
20     rm -rf $FOO
21     echo "done."
22 }
23
24 trap cleanup EXIT
25
26 #GPGID="$1"
27 GPGID=$(echo "$1" | cut -c 25-)
28
29 FOO=$(mktemp -d)
30
31 gpg --export-secret-key $GPGID | GNUPGHOME="$FOO" gpg --import
32
33 # idea to script the password stuff.  not working.
34 # read -s -p "enter gpg password: " PASSWD; echo
35 # cmd=$(cat <<EOF
36 # passwd
37 # $PASSWD
38 # \n
39 # \n
40 # \n
41 # yes
42 # save
43 # EOF
44 # )
45 # echo -e "$cmd" | GNUPGHOME="$FOO" gpg --command-fd 0 --edit-key $GPGID
46
47 GNUPGHOME="$FOO" gpg --edit-key $GPGID
48
49 GNUPGHOME="$FOO" gpg --export-secret-key $GPGID | openpgp2ssh $GPGID | ssh-add -c /dev/stdin