aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/openpgp/add-recipient.scm80
1 files changed, 42 insertions, 38 deletions
diff --git a/tests/openpgp/add-recipient.scm b/tests/openpgp/add-recipient.scm
index 7e6e68831..9f640329f 100644
--- a/tests/openpgp/add-recipient.scm
+++ b/tests/openpgp/add-recipient.scm
@@ -25,59 +25,63 @@
(define privkey2 "private-keys-v1.d/8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34.key")
;; Create encrypted copy of keys for key reimport
-(call-check `(,@GPG --enarmor ,privkey1))
-(call-check `(,@GPG --enarmor ,privkey2))
+(call-check `(,@GPG --enarmor ,privkey1))
+(call-check `(,@GPG --enarmor ,privkey2))
(for-each-p
"Checking add-recipient 0/2"
(lambda (source)
- (tr:do
- (tr:open source)
- (tr:gpg "" `( --encrypt --recipient ,usrname1))
- (tr:gpg "" `( --recipient ,usrname2 --add-recipient))
- (tr:write-to "reference")
- ;; Make usr1's priv unavailable
- (tr:unlink privkey1)
- (tr:spawn "" `(,@GPG --output **out** --decrypt "reference"))
- (tr:assert-identity source)
- ;; Reset enviroment
- (tr:spawn "" `(,@GPG -o ,privkey1 --dearmor ,(string-append privkey1 ".asc"))) ;;usrname1
- )
+ (lettmp (reference)
+ (tr:do
+ (tr:open source)
+ (tr:gpg "" `( --encrypt --recipient ,usrname1))
+ (tr:gpg "" `( --recipient ,usrname2 --add-recipient))
+ (tr:write-to reference)
+ ;; Make usr1's priv unavailable
+ (tr:unlink privkey1)
+ (tr:spawn "" `(,@GPG --output **out** --decrypt ,reference))
+ (tr:assert-identity source)
+ ;; Reset enviroment
+ (tr:spawn "" `(,@GPG -o ,privkey1 --dearmor ,(string-append privkey1 ".asc"))) ;;usrname1
+ )
+ )
)
(append all-files)
)
(for-each-p
"Checking change-recipient 1/2"
(lambda (source)
- (tr:do
- ;; Encrypt to usr1
- (tr:open source)
- (tr:gpg "" `( --encrypt --recipient ,usrname1))
+ (lettmp (reference)
+ (tr:do
+ ;; Encrypt to usr1
+ (tr:open source)
+ (tr:gpg "" `( --encrypt --recipient ,usrname1))
- ;; Change recipient to usr2
- (tr:gpg "" `( --recipient ,usrname2 --change-recipient))
- (tr:write-to "reference")
+ ;; Change recipient to usr2
+ (tr:gpg "" `( --recipient ,usrname2 --change-recipient))
+ (tr:write-to reference)
- ;; Setup keys for check 1
- (tr:unlink privkey2) ;;Remove key usr2
+ ;; Setup keys for check 1
+ (tr:unlink privkey2) ;;Remove key usr2
- ;; Check if usr1 can still decrypt if yes fail
- (tr:call-with-content
- (lambda (c)
- (assert(failed? (call-check `(,@GPG --output **out** --decrypt "reference"))))
- )
- )
- ;; Setup keys for check 2
- (tr:spawn "" `(,@GPG -o ,privkey2 --dearmor ,(string-append privkey2 ".asc"))) ;;Add key usr2
- (tr:unlink privkey1) ;;Remove key usr1
+ ;; Check if usr1 can still decrypt if yes fail
+ (tr:call-with-content
+ (lambda (c)
+ (assert(failed? (call-check `(,@GPG --output **out** --decrypt ,reference))))
+ )
+ )
+ ;; Setup keys for check 2
+ (tr:spawn "" `(,@GPG -o ,privkey2 --dearmor ,(string-append privkey2 ".asc"))) ;;Add key usr2
+ (tr:unlink privkey1) ;;Remove key usr1
- ;; Check if usr2 can decrypt if no fail
- (tr:spawn "" `(,@GPG --output **out** --decrypt "reference"))
- (tr:assert-identity source)
+ ;; Check if usr2 can decrypt if no fail
+ (tr:spawn "" `(,@GPG --output **out** --decrypt ,reference))
+ (tr:assert-identity source)
- ;; Reset enviroment
- (tr:spawn "" `(,@GPG -o ,privkey1 --dearmor ,(string-append privkey1 ".asc"))) ;;Add key usr1
- )
+ ;; Reset enviroment
+ (tr:spawn "" `(,@GPG -o ,privkey1 --dearmor ,(string-append privkey1 ".asc"))) ;;Add key usr1
+ )
+ )
)
(append all-files)
)