summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-06-06 19:47:20 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-06-06 19:47:20 -0300
commit42dd39666e32124265132c49843d77f34aaa1943 (patch)
tree4a8f449950c80c03bf66036d7f6a4130d5604465 /lib
parent126eb39671e9c65c0c60a78b25189e4d4b1fae72 (diff)
downloadkeyringer-42dd39666e32124265132c49843d77f34aaa1943.tar.gz
keyringer-42dd39666e32124265132c49843d77f34aaa1943.tar.bz2
Fix passphrase entry at genpairs when exporting secret keys; fix ChangeLog dates
Diffstat (limited to 'lib')
-rwxr-xr-xlib/keyringer/actions/genkeys9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/keyringer/actions/genkeys b/lib/keyringer/actions/genkeys
index deacbfd..e086891 100755
--- a/lib/keyringer/actions/genkeys
+++ b/lib/keyringer/actions/genkeys
@@ -66,8 +66,11 @@ function genkeys_gpg {
EOF
# Encrypt the result
+ # See https://superuser.com/questions/1135812/gpg2-asking-for-passphrase-when-importing-secret-keys#1135950
+ # https://stackoverflow.com/questions/49072403/suppress-the-passphrase-prompt-in-gpg-command
+ # https://dev.gnupg.org/T2313
echo "Encrypting secret key into keyringer..."
- $GPG --armor --homedir "$TMPWORK" --export-secret-keys | keyringer_exec encrypt "$BASEDIR" "$FILE"
+ echo -e "${passphrase}\n" | $GPG --armor --homedir "$TMPWORK" --passphrase-fd 0 --batch --no-tty --pinentry-mode=loopback --export-secret-keys | keyringer_exec encrypt "$BASEDIR" "$FILE"
echo "Encrypting public key into keyringer..."
$GPG --armor --homedir "$TMPWORK" --export | keyringer_exec encrypt "$BASEDIR" "$FILE.pub"
#echo "Encrypting passphrase into keyringer..."
@@ -76,8 +79,8 @@ EOF
if [ ! -z "$OUTFILE" ]; then
mkdir -p `dirname $OUTFILE`
printf "Saving copies at %s and %s.pub\n" "$OUTFILE" "$OUTFILE"
- $GPG --armor --homedir "$TMPWORK" --export-secret-keys > "$OUTFILE"
- $GPG --armor --homedir "$TMPWORK" --export > "$OUTFILE.pub"
+ echo -e "${passphrase}\n" | $GPG --armor --homedir "$TMPWORK" --passphrase-fd 0 --batch --no-tty --pinentry-mode=loopback --export-secret-keys > "$OUTFILE"
+ $GPG --armor --homedir "$TMPWORK" --export > "$OUTFILE.pub"
fi
echo "Done"