summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Pujol <alexandre@pujol.io>2017-02-02 23:41:09 (GMT)
committer Alexandre Pujol <alexandre@pujol.io>2017-02-03 23:57:52 (GMT)
commit47ddeebbc48720310616a909c7f12637c855552b (patch)
tree0ba524519e389868c555672749c3ef3381ed5ebf
parent5a35ab9668e5613f731baaaf089a002ddd9f4db7 (diff)
Add support to change the GPG key used to encrypt a tomb key. (tomb passwd)
-rwxr-xr-xextras/test/runtests12
-rwxr-xr-xtomb9
2 files changed, 18 insertions, 3 deletions
diff --git a/extras/test/runtests b/extras/test/runtests
index 3d2ff22..9152acc 100755
--- a/extras/test/runtests
+++ b/extras/test/runtests
@@ -57,7 +57,7 @@ command -v qrencode > /dev/null || QRENCODE=0
typeset -A results
tests=(dig forge lock badpass open close passwd chksum bind setkey
-recip-dig recip-forge recip-lock recip-open recip-close)
+recip-dig recip-forge recip-lock recip-open recip-close recip-passwd)
{ test $RESIZER = 1 } && { tests+=(resize) }
{ test $KDF = 1 } && { tests+=(kdforge kdfpass kdflock kdfopen) }
{ test $STEGHIDE = 1 } && { tests+=(stgin stgout stgopen stgpipe stgimpl
@@ -162,6 +162,16 @@ test-tomb-recip() {
tt close recip
}
+ notice "Testing tomb with recipient changing gpg key: passwd"
+ res=0
+ tt passwd -k $tomb_key -r $gpgid_1 -R $gpgid_2
+ { test $? = 0 } || { res=1 }
+ tt open $tomb -k $tomb_key -r $gpgid_2
+ { test $? = 0 } || { res=1 }
+ tt close recip
+ { test $? = 0 } || { res=1 }
+ { test $res = 0 } && { results+=(recip-passwd SUCCESS) }
+
}
test-bind-hooks() {
diff --git a/tomb b/tomb
index da2c70b..4e5bd96 100755
--- a/tomb
+++ b/tomb
@@ -1173,7 +1173,12 @@ gen_key() {
tombpasstmp=""
{ option_is_set -r } && {
- local gpgkey=`option_value -r`
+ { option_is_set -R } && {
+ local gpgkey=`option_value -R`
+ } || {
+ local gpgkey=`option_value -r`
+ }
+
_verbose "using $gpgkey to encrypt a tomb key"
{ is_valid_recipients "$gpgkey" } || {
_failure "You set an invalid GPG ID."
@@ -2669,7 +2674,7 @@ main() {
subcommands_opts[setkey]="k: -ignore-swap -kdf: -tomb-old-pwd: -tomb-pwd: "
subcommands_opts[engrave]="k: "
- subcommands_opts[passwd]="k: -ignore-swap -kdf: -tomb-old-pwd: -tomb-pwd: "
+ subcommands_opts[passwd]="k: -ignore-swap -kdf: -tomb-old-pwd: -tomb-pwd: r: R: "
subcommands_opts[close]=""
subcommands_opts[help]=""
subcommands_opts[slam]=""