enforce --no-armor when exporting to openpgp2ssh in case weird gpg.conf options ...
[monkeysphere.git] / src / share / m / subkey_to_ssh_agent
index aa647a628ae9f0e96e04948056f9279cbf5789d2..36eab4f751ce21cdc1baefef000a0d5cc0782da5 100644 (file)
@@ -27,7 +27,7 @@ subkey_to_ssh_agent() {
     local kname
 
     # if there's no agent running, don't bother:
-    if [ -z "$SSH_AUTH_SOCK" ] || ! which ssh-add >/dev/null ; then
+    if [ -z "$SSH_AUTH_SOCK" ] || ! type ssh-add >/dev/null ; then
        failure "No ssh-agent available."
     fi
 
@@ -98,14 +98,14 @@ You might want to run 'monkeysphere gen-subkey'."
 
        if [ "$1" = '-d' ]; then
            # we're removing the subkey:
-           gpg_user --export "0x${subkey}!" | openpgp2ssh "$subkey" > "$workingdir/$kname"
+           gpg_user --export --no-armor "0x${subkey}!" | openpgp2ssh "$subkey" > "$workingdir/$kname"
            (cd "$workingdir" && ssh-add -d "$kname") || keysuccess="$?"
        else
            # we're adding the subkey:
            mkfifo "$workingdir/$kname"
            gpg_user --passphrase-fd 3 3<"$workingdir/passphrase" \
                --export-options export-reset-subkey-passwd,export-minimal,no-export-attributes \
-               --export-secret-subkeys "0x${subkey}!" | openpgp2ssh "$subkey" > "$workingdir/$kname" &
+               --export-secret-subkeys --no-armor "0x${subkey}!" | openpgp2ssh "$subkey" > "$workingdir/$kname" &
            (cd "$workingdir" && DISPLAY=nosuchdisplay SSH_ASKPASS=/bin/false ssh-add "$@" "$kname" </dev/null )&
 
            passphrase_prompt "Enter passphrase for key $kname: " "$workingdir/passphrase"