diff options
-rw-r--r-- | tests/gpgscm/tests.scm | 5 | ||||
-rw-r--r-- | tests/openpgp/Makefile.am | 1 | ||||
-rw-r--r-- | tests/openpgp/add-recipient.scm | 41 |
3 files changed, 47 insertions, 0 deletions
diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm index 1e6d7fea0..486a77e85 100644 --- a/tests/gpgscm/tests.scm +++ b/tests/gpgscm/tests.scm @@ -451,6 +451,11 @@ (rename source pathname) (list tmpfiles pathname #f))) +(define (tr:unlink pathname) + (lambda (tmpfiles source) + (unlink pathname) + (list tmpfiles pathname #f))) + (define (tr:pipe-do . commands) (lambda (tmpfiles source) (let ((t (make-temporary-file))) diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index d1f04e99b..05270d2e1 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -99,6 +99,7 @@ XTESTS = \ key-selection.scm \ delete-keys.scm \ gpgconf.scm \ + add-recipient.scm \ issue2015.scm \ issue2346.scm \ issue2417.scm \ diff --git a/tests/openpgp/add-recipient.scm b/tests/openpgp/add-recipient.scm new file mode 100644 index 000000000..bf10dded2 --- /dev/null +++ b/tests/openpgp/add-recipient.scm @@ -0,0 +1,41 @@ +#!/usr/bin/env gpgscm + +;; Copyright (C) 2025 g10 Code GmbH +;; +;; This file is part of GnuPG. +;; +;; GnuPG is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. +;; +;; GnuPG is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, see <http://www.gnu.org/licenses/>. + +(load (in-srcdir "tests" "openpgp" "defs.scm")) +(setup-legacy-environment) + +(for-each-p + "Checking encryption" + (lambda (source) + (tr:do + (tr:open source) + (tr:gpg "" `(--yes --encrypt --recipient ,usrname1)) + (tr:gpg "" `(--yes --recipient ,usrname2 --add-recipient)) + (tr:write-to "reference") + ;; Make username1's priv unavailable + (tr:spawn "" `(,@GPG --batch --yes --enarmor "private-keys-v1.d/7E201E28B6FEB2927B321F443205F4724EBE637E.key")) ;;usrname1 + (tr:unlink "private-keys-v1.d/7E201E28B6FEB2927B321F443205F4724EBE637E.key") + (tr:spawn "" `(,@GPG --output **out** --yes --decrypt "reference")) + (tr:assert-identity source) + ;; Reset enviroment + (tr:spawn "" `(,@GPG --batch --yes -o "private-keys-v1.d/7E201E28B6FEB2927B321F443205F4724EBE637E.key" --dearmor "private-keys-v1.d/7E201E28B6FEB2927B321F443205F4724EBE637E.key.asc")) ;;usrname1 + ) + ) + (append all-files) +) |