aboutsummaryrefslogtreecommitdiff
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
parent126eb39671e9c65c0c60a78b25189e4d4b1fae72 (diff)
downloadkeyringer-42dd39666e32124265132c49843d77f34aaa1943.tar.gz
keyringer-42dd39666e32124265132c49843d77f34aaa1943.tar.bz2
Fix passphrase entry at genpairs when exporting secret keys; fix ChangeLog dates
-rw-r--r--ChangeLog6
-rwxr-xr-xlib/keyringer/actions/genkeys9
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 6487c06..1d0b4e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-2017-11-23 - 0.5.3 - Silvio Rhatto <rhatto@riseup.net>
+2010-06-06 - unreleased - Silvio Rhatto <rhatto@riseup.net>
+
+ Fix passphrase entry at genpairs when exporting secret keys
+
+2018-05-30 - 0.5.3 - Silvio Rhatto <rhatto@riseup.net>
Grégoire Jadi <gjadi@omecha.info>
Jérémie Courrèges-Anglas <jca@wxcvbn.org>
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"