aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"