Add tomb setkey support for GPG key

This commit is contained in:
Alexandre Pujol 2017-02-03 00:16:29 +00:00
parent a200448de2
commit 53b7460274
2 changed files with 16 additions and 3 deletions

View File

@ -56,8 +56,9 @@ command -v qrencode > /dev/null || QRENCODE=0
typeset -A results typeset -A results
tests=(dig forge lock badpass open close passwd chksum bind setkey tests=(dig forge lock badpass open close passwd chksum bind setkey recip-dig
recip-dig recip-forge recip-lock recip-open recip-close recip-passwd recip-resize) recip-forge recip-lock recip-open recip-close recip-passwd recip-resize
recip-setkey)
{ test $RESIZER = 1 } && { tests+=(resize) } { test $RESIZER = 1 } && { tests+=(resize) }
{ test $KDF = 1 } && { tests+=(kdforge kdfpass kdflock kdfopen) } { test $KDF = 1 } && { tests+=(kdforge kdfpass kdflock kdfopen) }
{ test $STEGHIDE = 1 } && { tests+=(stgin stgout stgopen stgpipe stgimpl { test $STEGHIDE = 1 } && { tests+=(stgin stgout stgopen stgpipe stgimpl
@ -176,6 +177,18 @@ test-tomb-recip() {
tt resize -s 30 $tomb -k $tomb_key -r $gpgid_2 tt resize -s 30 $tomb -k $tomb_key -r $gpgid_2
{ test $? = 0 } && { results+=(recip-resize SUCCESS) } { test $? = 0 } && { results+=(recip-resize SUCCESS) }
notice "Testing tomb with recipient setting a new key: setkey"
sudo rm -f /tmp/new.recip.tomb.key
res=0
tt forge /tmp/new.recip.tomb.key -r $gpgid_2 \
--ignore-swap --unsafe --use-urandom
{ test $? = 0 } || { res=1 }
tt setkey -k /tmp/new.recip.tomb.key $tomb_key $tomb -r $gpgid_2
{ test $? = 0 } || { res=1 }
tt open -k /tmp/new.recip.tomb.key $tomb -r $gpgid_2
{ test $? = 0 } || { res=1 }
{ test $res = 0 } && { results+=(recip-setkey SUCCESS) }
tt close recip
} }
test-bind-hooks() { test-bind-hooks() {

2
tomb
View File

@ -2671,7 +2671,7 @@ main() {
subcommands_opts[forge]="-ignore-swap k: -kdf: o: -tomb-pwd: -use-urandom r: " subcommands_opts[forge]="-ignore-swap k: -kdf: o: -tomb-pwd: -use-urandom r: "
subcommands_opts[dig]="-ignore-swap s: -size=s " subcommands_opts[dig]="-ignore-swap s: -size=s "
subcommands_opts[lock]="-ignore-swap k: -kdf: o: -tomb-pwd: r: " subcommands_opts[lock]="-ignore-swap k: -kdf: o: -tomb-pwd: r: "
subcommands_opts[setkey]="k: -ignore-swap -kdf: -tomb-old-pwd: -tomb-pwd: " subcommands_opts[setkey]="k: -ignore-swap -kdf: -tomb-old-pwd: -tomb-pwd: r: "
subcommands_opts[engrave]="k: " subcommands_opts[engrave]="k: "
subcommands_opts[passwd]="k: -ignore-swap -kdf: -tomb-old-pwd: -tomb-pwd: r: R: " subcommands_opts[passwd]="k: -ignore-swap -kdf: -tomb-old-pwd: -tomb-pwd: r: R: "