X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fseckey2sshagent;h=a516256e29d92bf5671e3097a2a3af1ee9453a63;hb=46586fc0f24e24166a52c2a0efb3e2ab838eea81;hp=15e2706ff444aa04aa5c4cf6a68aa11f10d12ab4;hpb=bee2295c0e205787584788d1e611e92ec6b0fe96;p=monkeysphere.git diff --git a/src/seckey2sshagent b/src/seckey2sshagent index 15e2706..a516256 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. @@ -14,36 +14,130 @@ # Authors: Daniel Kahn Gillmor , # Jameson Rollins +explanation() { + + cat < + +followed by the empty string for the new password. GPG will ask you +if you're really sure. Answer yes, because this is only relevant to +the temporary keyring. Then, do: + + save + +At this point, your key will be added to your running ssh-agent with +the alias 'monkeysphere-key' and seckey2sshagent should terminate. +You can check on it with: + + ssh-add -l + +EOF +} cleanup() { - echo -n "removing temp gpg home... " - rm -rf $FOO - echo "done." + echo -n "removing temp gpg home... " 1>&2 + rm -rf "$TMPPRIVATE" + echo "done." 1>&2 +} + +export_sec_key() { + gpg --export-secret-key "$GPGID" | GNUPGHOME="$TMPPRIVATE" gpg --import + + GNUPGHOME="$TMPPRIVATE" gpg --edit-key "$GPGID" + + # idea to script the password stuff. not working. + # read -s -p "enter gpg password: " PASSWD; echo + # cmd=$(cat < "$TMPPRIVATE/key" + # passprotect file + ssh-keygen -f "${TMPPRIVATE}/key" -p + # move into place + mv "${TMPPRIVATE}/key" "$FILE" + + # export public key + gpg --export "$GPGID" | openpgp2ssh "$GPGID" > "${FILE}.pub" -gpg --export-secret-key $GPGID | GNUPGHOME="$FOO" gpg --import + # otherwise add to agent + else + KEYNAME='MonkeySphere Key '$(echo "$GPGID" | tr -c -d '0-9a-fA-F')'' -# idea to script the password stuff. not working. -# read -s -p "enter gpg password: " PASSWD; echo -# cmd=$(cat <