mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-22 12:35:13 +00:00
Fix issues with GPG default key.
- Remove --no-options gpg option when using GPG key. - Improve gpg default key tests To use the default key, ~/.gnupg/gpg.conf needs: default-key <keyid> default-recipient-self Or default-recipient <keyid> Otherwise the first key in the keyring is used.
This commit is contained in:
parent
d720e4b2ce
commit
c303513be4
8
extras/test/gnupg/gpg.conf
Normal file
8
extras/test/gnupg/gpg.conf
Normal file
@ -0,0 +1,8 @@
|
||||
# ~/.gnupg/gpg.conf
|
||||
|
||||
# Description of options can be found here:
|
||||
# http://www.gnupg.org/documentation/manuals/gnupg-devel/GPG-Options.html
|
||||
|
||||
# GPG Configuration Options
|
||||
default-key 0B2235E660753AB0475FB3E23DC836481F44B31E
|
||||
default-recipient-self
|
@ -196,7 +196,7 @@ test-tomb-recip() {
|
||||
test-tomb-recip-default() {
|
||||
|
||||
notice "wiping all default.tomb* in /tmp"
|
||||
rm -f /tmp/default.tomb /tmp/default.tomb.key
|
||||
rm -f /tmp/default.tomb /tmp/default.tomb.key /tmp/default.tmp
|
||||
|
||||
notice "Testing tomb with the default recipient"
|
||||
res=0
|
||||
@ -207,6 +207,8 @@ test-tomb-recip-default() {
|
||||
tt lock /tmp/default.tomb -k /tmp/default.tomb.key \
|
||||
--ignore-swap --unsafe -g
|
||||
{ test $? = 0 } || { res=1 }
|
||||
gpg -d --status-fd 2 /tmp/default.tomb.key 1> /dev/null 2> /tmp/default.tmp
|
||||
[[ -z "$(grep 'Tomb Test 2' /tmp/default.tmp)" ]] && { res=1 }
|
||||
{ test $res = 0 } && { results+=(recip-default SUCCESS) }
|
||||
}
|
||||
|
||||
|
12
tomb
12
tomb
@ -995,7 +995,7 @@ gpg_decrypt() {
|
||||
local gpgpass="$1\n$TOMBKEY"
|
||||
local tmpres ret
|
||||
typeset -a gpgopt
|
||||
gpgpopt=(--batch --no-tty --passphrase-fd 0)
|
||||
gpgpopt=(--batch --no-tty --passphrase-fd 0 --no-options)
|
||||
|
||||
{ option_is_set -g } && {
|
||||
gpgpass="$TOMBKEY"
|
||||
@ -1015,7 +1015,7 @@ gpg_decrypt() {
|
||||
[[ $gpgver == "1.4.11" ]] && {
|
||||
_verbose "GnuPG is version 1.4.11 - adopting status fix."
|
||||
TOMBSECRET=`print - "$gpgpass" | \
|
||||
gpg --decrypt ${gpgpopt[@]} --no-options`
|
||||
gpg --decrypt ${gpgpopt[@]}`
|
||||
ret=$?
|
||||
unset gpgpass
|
||||
return $ret
|
||||
@ -1024,7 +1024,7 @@ gpg_decrypt() {
|
||||
_tmp_create
|
||||
tmpres=$TOMBTMP
|
||||
TOMBSECRET=`print - "$gpgpass" | \
|
||||
gpg --decrypt ${gpgpopt[@]} --no-options \
|
||||
gpg --decrypt ${gpgpopt[@]} \
|
||||
--status-fd 2 --no-mdc-warning --no-permission-warning \
|
||||
--no-secmem-warning 2> $tmpres`
|
||||
unset gpgpass
|
||||
@ -1329,15 +1329,15 @@ gen_key() {
|
||||
|
||||
# Set gpg inputs and options
|
||||
gpgpass="${tombpass}\n$TOMBSECRET"
|
||||
gpgopt=(--passphrase-fd 0 --symmetric)
|
||||
gpgopt=(--passphrase-fd 0 --symmetric --no-options)
|
||||
opt='-n'
|
||||
}
|
||||
|
||||
_tmp_create
|
||||
local tmpres=$TOMBTMP
|
||||
print $opt - "$gpgpass" \
|
||||
| gpg --openpgp --force-mdc --cipher-algo ${algo} --batch \
|
||||
--no-options --no-tty ${gpgopt[@]} \
|
||||
| gpg --openpgp --force-mdc --cipher-algo ${algo} \
|
||||
--batch --no-tty ${gpgopt[@]} \
|
||||
--status-fd 2 -o - --armor 2> $tmpres
|
||||
unset gpgpass
|
||||
# check result of gpg operation
|
||||
|
Loading…
Reference in New Issue
Block a user