summaryrefslogtreecommitdiffstats
path: root/tests/sm-sign+verify
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:14:06 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:14:06 +0000
commiteee068778cb28ecf3c14e1bf843a95547d72c42d (patch)
tree0e07b30ddc5ea579d682d5dbe57998200d1c9ab7 /tests/sm-sign+verify
parentInitial commit. (diff)
downloadgnupg2-eee068778cb28ecf3c14e1bf843a95547d72c42d.tar.xz
gnupg2-eee068778cb28ecf3c14e1bf843a95547d72c42d.zip
Adding upstream version 2.2.40.upstream/2.2.40upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/sm-sign+verify')
-rw-r--r--tests/sm-sign+verify73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/sm-sign+verify b/tests/sm-sign+verify
new file mode 100644
index 0000000..1c3ae7d
--- /dev/null
+++ b/tests/sm-sign+verify
@@ -0,0 +1,73 @@
+# sm-sign+verify
+#
+# Creating a signature and verifying it
+# Requirements: a plain file "text-1.txt"
+
+srcdir = getenv srcdir
+plaintext = let $srcdir/text-1.txt
+
+in = openfile $plaintext
+out = createfile msg.sig
+in2 = openfile msg.sig
+out2 = createfile msg.unsig
+
+pipeserver $GPGSM
+send INPUT FD=$in
+expect-ok
+send OUTPUT FD=$out
+expect-ok
+send SIGN
+expect-ok
+
+send RESET
+expect-ok
+send INPUT FD=$in2
+expect-ok
+send OUTPUT FD=$out2
+expect-ok
+goodsig = count-status GOODSIG
+trusted = count-status TRUST_FULLY
+send VERIFY
+expect-ok
+echo goodsig=$goodsig trusted=$trusted
+fail-if !$goodsig
+fail-if !$trusted
+send BYE
+expect-ok
+
+# Unset variables so that the files get closed.
+in =
+out =
+in2 =
+out2=
+
+cmpfiles $plaintext msg.unsig
+fail-if !$?
+
+# Lets check it again with a new server instance, this time we keep
+# the server running to check whether the entire message has been
+# output after the VERIFY.
+in = openfile msg.sig
+out = createfile msg.unsig
+pipeserver $GPGSM
+send INPUT FD=$in
+expect-ok
+send OUTPUT FD=$out
+expect-ok
+goodsig = count-status GOODSIG
+trusted = count-status TRUST_FULLY
+send VERIFY
+expect-ok
+echo goodsig=$goodsig trusted=$trusted
+fail-if !$goodsig
+fail-if !$trusted
+
+cmpfiles $plaintext msg.unsig
+fail-if !$?
+
+send BYE
+expect-ok
+
+
+quit
+