* asschk.c: Added some new features.
authorWerner Koch <wk@gnupg.org>
Thu, 8 Aug 2002 16:32:01 +0000 (16:32 +0000)
committerWerner Koch <wk@gnupg.org>
Thu, 8 Aug 2002 16:32:01 +0000 (16:32 +0000)
* runtest, inittests: New.
* text-1.txt, text-2.txt, text-3.txt: New.
* text-1.osig.pem, text-1.dsig.pem, text-1.osig-bad.pem: New.
* text-2.osig.pem, text-2.osig-bad.pem: New.
* samplekeys : New directory
* sm-verify, sm-sign+verify: The first test scripts.

19 files changed:
tests/ChangeLog
tests/Makefile.am
tests/asschk.c
tests/inittests [new file with mode: 0755]
tests/runtest [new file with mode: 0755]
tests/samplekeys/32100C27173EF6E9C4E9A25D3D69F86D37A4F939.key [new file with mode: 0644]
tests/samplekeys/cert_g10code_pete1.pem [moved from tests/cert_g10code_pete1.pem with 100% similarity]
tests/samplekeys/cert_g10code_test1.pem [moved from tests/cert_g10code_test1.pem with 100% similarity]
tests/samplekeys/cert_g10code_theo1.pem [moved from tests/cert_g10code_theo1.pem with 100% similarity]
tests/sm-sign+verify
tests/sm-verify [new file with mode: 0644]
tests/text-1.dsig.pem [new file with mode: 0644]
tests/text-1.osig-bad.pem [new file with mode: 0644]
tests/text-1.osig.pem [new file with mode: 0644]
tests/text-1.txt [new file with mode: 0644]
tests/text-2.osig-bad.pem [new file with mode: 0644]
tests/text-2.osig.pem [new file with mode: 0644]
tests/text-2.txt [new file with mode: 0644]
tests/text-3.txt [new file with mode: 0644]

index f1a9d87..1711e95 100644 (file)
@@ -1,3 +1,13 @@
+2002-08-08  Werner Koch  <wk@gnupg.org>
+
+       * asschk.c: Added some new features.
+       * runtest, inittests: New.
+       * text-1.txt, text-2.txt, text-3.txt: New.
+       * text-1.osig.pem, text-1.dsig.pem, text-1.osig-bad.pem: New.
+       * text-2.osig.pem, text-2.osig-bad.pem: New.
+       * samplekeys : New directory
+       * sm-verify, sm-sign+verify: The first test scripts.
+
 2002-08-06  Werner Koch  <wk@gnupg.org>
 
        * Makefile.am, asschk.c: New.
 2002-08-06  Werner Koch  <wk@gnupg.org>
 
        * Makefile.am, asschk.c: New.
index 59740ef..15c2e4c 100644 (file)
 
 ## Process this file with automake to produce Makefile.in
 
 
 ## Process this file with automake to produce Makefile.in
 
-TESTS_ENVIRONMENT = 
+GPGSM = ../sm/gpgsm
 
 
-EXTRA_DIST =
+# We can't unset a variable here so we unset GPG_AGENT_INFO in runtest
+TESTS_ENVIRONMENT = GNUPGHOME=`pwd` LC_ALL=C GPGSM=${GPGSM} ./runtest
 
 
-TESTS = 
+EXTRA_DIST = runtest inittests \
+            text-1.txt text-2.txt text-3.txt \
+            text-1.osig.pem text-1.dsig.pem text-1.osig-bad.pem \
+            text-2.osig.pem text-2.osig-bad.pem
 
 
-noinst_PROGRAMS = asschk $(TESTS) 
+TESTS = sm-sign+verify sm-verify
+
+CLEANFILES = inittests.stamp x y y z out err 
+            *.lock .\#lk* 
+
+DISTCLEANFILES = keyring.kbx~ random_seed
+
+noinst_PROGRAMS = asschk
 
 asschk_SOURCES = asschk.c
 
 
 
 asschk_SOURCES = asschk.c
 
 
+all-local: inittests.stamp
+
+clean-local:
+       $(TESTS_ENVIRONMENT) $(srcdir)/inittests --clean
+
+inittests.stamp: inittests
+       $(TESTS_ENVIRONMENT) $(srcdir)/inittests
+       echo timestamp >./inittests.stamp
+
+
+
+
 
 
index 298d7bb..7b73216 100644 (file)
@@ -65,9 +65,8 @@
       Create file FILENAME, open for write access and retrun the file
       descriptor.
 
       Create file FILENAME, open for write access and retrun the file
       descriptor.
 
-   pipeserver [<path>]
-      Connect to an Assuan server with name PATH.  If PATH is not
-      specified the value ../sm/gpgsm is used.
+   pipeserver <program>
+      Connect to the Assuan server PROGRAM.
 
    send <line>
       Send LINE to the server.
 
    send <line>
       Send LINE to the server.
       Expect an ERR response from the server.  Status and data out put
       is ignored.
 
       Expect an ERR response from the server.  Status and data out put
       is ignored.
 
+   count-status <code>
+      Initialize the assigned variable to 0 and assign it as an counter for 
+      status code CODE.  This command must be called with an assignment.
+
    quit
       Terminate the process.
 
    quit
       Terminate the process.
 
 
 #define spacep(p) (*(p) == ' ' || *(p) == '\t')
 
 
 #define spacep(p) (*(p) == ' ' || *(p) == '\t')
 
+#define MAX_LINELEN 2048
+
 typedef enum {
   LINE_OK = 0,
   LINE_ERR,
 typedef enum {
   LINE_OK = 0,
   LINE_ERR,
@@ -120,17 +125,23 @@ typedef enum {
   LINE_END,
 } LINETYPE;
 
   LINE_END,
 } LINETYPE;
 
+typedef enum {
+  VARTYPE_SIMPLE = 0,
+  VARTYPE_FD,
+  VARTYPE_COUNTER
+} VARTYPE;
+
 
 struct variable_s {
   struct variable_s *next;
 
 struct variable_s {
   struct variable_s *next;
-  int is_fd;
+  VARTYPE type;
+  unsigned int count;
   char *value;
   char name[1];
 };
 typedef struct variable_s *VARIABLE;
 
 
   char *value;
   char name[1];
 };
 typedef struct variable_s *VARIABLE;
 
 
-
 static void die (const char *format, ...)  ATTR_PRINTF(1,2);
 
 
 static void die (const char *format, ...)  ATTR_PRINTF(1,2);
 
 
@@ -140,6 +151,9 @@ static const char *invocation_name;
 /* Talk a bit about what is going on. */
 static int opt_verbose;
 
 /* Talk a bit about what is going on. */
 static int opt_verbose;
 
+/* Option to ignore the echo command. */
+static int opt_no_echo;
+
 /* File descriptors used to communicate with the current server. */
 static int server_send_fd = -1;
 static int server_recv_fd = -1;
 /* File descriptors used to communicate with the current server. */
 static int server_send_fd = -1;
 static int server_recv_fd = -1;
@@ -147,7 +161,7 @@ static int server_recv_fd = -1;
 /* The Assuan protocol limits the line length to 1024, so we can
    safely use a (larger) buffer.  The buffer is filled using the
    read_assuan(). */
 /* The Assuan protocol limits the line length to 1024, so we can
    safely use a (larger) buffer.  The buffer is filled using the
    read_assuan(). */
-static char recv_line[2048];
+static char recv_line[MAX_LINELEN];
 /* Tell the status of the current line. */
 static LINETYPE recv_type;
 
 /* Tell the status of the current line. */
 static LINETYPE recv_type;
 
@@ -245,6 +259,8 @@ writen (int fd, const char *buffer, size_t length)
 static char *
 read_assuan (int fd)
 {
 static char *
 read_assuan (int fd)
 {
+  static char pending[MAX_LINELEN];
+  static size_t pending_len;
   size_t nleft = sizeof recv_line;
   char *buf = recv_line;
   char *p;
   size_t nleft = sizeof recv_line;
   char *buf = recv_line;
   char *p;
@@ -252,7 +268,18 @@ read_assuan (int fd)
 
   while (nleft > 0)
     {
 
   while (nleft > 0)
     {
-      int n = read (fd, buf, nleft);
+      int n;
+
+      if (pending_len)
+        {
+          if (pending_len >= nleft)
+            die ("received line too large");
+          memcpy (buf, pending, pending_len);
+          n = pending_len;
+          pending_len = 0;
+        }
+      else
+        n = read (fd, buf, nleft);
       if (n < 0)
         {
           if (errno == EINTR)
       if (n < 0)
         {
           if (errno == EINTR)
@@ -270,7 +297,12 @@ read_assuan (int fd)
         ;
       if (n)
         {
         ;
       if (n)
         {
-          /* fixme: keep pending bytes for next read. */
+          if (n>1)
+            {
+              n--;
+              memcpy (pending, p+1, n);
+              pending_len = n;
+            }
           break;
         }
     }
           break;
         }
     }
@@ -278,7 +310,7 @@ read_assuan (int fd)
     die ("received line too large");
   assert (nread>0);
   recv_line[nread-1] = 0;
     die ("received line too large");
   assert (nread>0);
   recv_line[nread-1] = 0;
-  
+
   p = recv_line;
   if (p[0] == 'O' && p[1] == 'K' && (p[2] == ' ' || !p[2]))
     {
   p = recv_line;
   if (p[0] == 'O' && p[1] == 'K' && (p[2] == ' ' || !p[2]))
     {
@@ -375,6 +407,15 @@ start_server (const char *pgmname)
               die ("dup2 failed in child: %s", strerror (errno));
           close (rp[1]);
         }
               die ("dup2 failed in child: %s", strerror (errno));
           close (rp[1]);
         }
+      if (!opt_verbose)
+        {
+         int fd = open ("/dev/null", O_WRONLY);
+         if (fd == -1)
+           die ("can't open `/dev/null': %s", strerror (errno));
+          if (dup2 (fd, STDERR_FILENO) == -1)
+            die ("dup2 failed in child: %s", strerror (errno));
+         close (fd);
+        }
 
       execl (pgmname, arg0, "--server", NULL); 
       die ("exec failed for `%s': %s", pgmname, strerror (errno));
 
       execl (pgmname, arg0, "--server", NULL); 
       die ("exec failed for `%s': %s", pgmname, strerror (errno));
@@ -406,7 +447,7 @@ unset_var (const char *name)
     return;
 /*    fprintf (stderr, "unsetting `%s'\n", name); */
 
     return;
 /*    fprintf (stderr, "unsetting `%s'\n", name); */
 
-  if (var->is_fd && var->value)
+  if (var->type == VARTYPE_FD && var->value)
     {
       int fd;
 
     {
       int fd;
 
@@ -417,12 +458,13 @@ unset_var (const char *name)
 
   free (var->value);
   var->value = NULL;
 
   free (var->value);
   var->value = NULL;
-  var->is_fd = 0;
+  var->type = 0;
+  var->count = 0;
 }
 
 
 static void
 }
 
 
 static void
-set_fd_var (const char *name, const char *value, int is_fd)
+set_type_var (const char *name, const char *value, VARTYPE type)
 {
   VARIABLE var;
 
 {
   VARIABLE var;
 
@@ -440,7 +482,7 @@ set_fd_var (const char *name, const char *value, int is_fd)
   else
     free (var->value);
 
   else
     free (var->value);
 
-  if (var->is_fd && var->value)
+  if (var->type == VARTYPE_FD && var->value)
     {
       int fd;
 
     {
       int fd;
 
@@ -449,16 +491,22 @@ set_fd_var (const char *name, const char *value, int is_fd)
           close (fd);
     }
   
           close (fd);
     }
   
-  var->is_fd = is_fd;
-  var->value = xstrdup (value);
-/*    fprintf (stderr, "setting `%s' to `%s'\n", var->name, var->value); */
-
+  var->type = type;
+  var->count = 0;
+  if (var->type == VARTYPE_COUNTER)
+    {
+      /* We need some extra sapce as scratch area for get_var. */
+      var->value = xmalloc (strlen (value) + 1 + 20);
+      strcpy (var->value, value);
+    }
+  else
+    var->value = xstrdup (value);
 }
 
 static void
 set_var (const char *name, const char *value)
 {
 }
 
 static void
 set_var (const char *name, const char *value)
 {
-  set_fd_var (name, value, 0);
+  set_type_var (name, value, 0);
 }
 
 
 }
 
 
@@ -469,10 +517,35 @@ get_var (const char *name)
 
   for (var=variable_list; var && strcmp (var->name, name); var = var->next)
     ;
 
   for (var=variable_list; var && strcmp (var->name, name); var = var->next)
     ;
-  return var? var->value:NULL;
+  if (!var)
+    return NULL;
+  if (var->type == VARTYPE_COUNTER && var->value)
+    { /* Use the scratch space allocated by set_var. */
+      char *p = var->value + strlen(var->value)+1;
+      sprintf (p, "%u", var->count);
+      return p;
+    }
+  else
+    return var->value;
 }
 
 
 }
 
 
+/* Incremente all counter type variables with NAME in their VALUE. */
+static void
+inc_counter (const char *name)
+{
+  VARIABLE var;
+
+  if (!*name)
+    return;
+  for (var=variable_list; var; var = var->next)
+    {
+      if (var->type == VARTYPE_COUNTER
+          && var->value && !strcmp (var->value, name))
+        var->count++;
+    }
+}
+
 
 /* Expand variables in LINE and return a new allocated buffer if
    required.  The function might modify LINE if the expanded version
 
 /* Expand variables in LINE and return a new allocated buffer if
    required.  The function might modify LINE if the expanded version
@@ -568,7 +641,8 @@ cmd_let (const char *assign_to, char *arg)
 static void
 cmd_echo (const char *assign_to, char *arg)
 {
 static void
 cmd_echo (const char *assign_to, char *arg)
 {
-  printf ("%s\n", arg);
+  if (!opt_no_echo)
+    printf ("%s\n", arg);
 }
 
 static void
 }
 
 static void
@@ -580,15 +654,35 @@ cmd_send (const char *assign_to, char *arg)
 }
 
 static void
 }
 
 static void
+handle_status_line (char *arg)
+{
+  char *p;
+
+  for (p=arg; *p && !spacep (p); p++)
+    ;
+  if (*p)
+    {
+      int save = *p;
+      *p = 0;
+      inc_counter (arg);
+      *p = save;
+    }
+  else
+    inc_counter (arg);
+}
+
+static void
 cmd_expect_ok (const char *assign_to, char *arg)
 {
   if (opt_verbose)
     fprintf (stderr, "expecting OK\n");
   do
     {
 cmd_expect_ok (const char *assign_to, char *arg)
 {
   if (opt_verbose)
     fprintf (stderr, "expecting OK\n");
   do
     {
-      read_assuan (server_recv_fd);
-      if (opt_verbose)
+      char *p = read_assuan (server_recv_fd);
+      if (opt_verbose > 1)
         fprintf (stderr, "got line `%s'\n", recv_line);
         fprintf (stderr, "got line `%s'\n", recv_line);
+      if (recv_type == LINE_STAT)
+        handle_status_line (p);
     }
   while (recv_type != LINE_OK && recv_type != LINE_ERR);
   if (recv_type != LINE_OK)
     }
   while (recv_type != LINE_OK && recv_type != LINE_ERR);
   if (recv_type != LINE_OK)
@@ -602,9 +696,11 @@ cmd_expect_err (const char *assign_to, char *arg)
     fprintf (stderr, "expecting ERR\n");
   do
     {
     fprintf (stderr, "expecting ERR\n");
   do
     {
-      read_assuan (server_recv_fd);
-      if (opt_verbose)
+      char *p = read_assuan (server_recv_fd);
+      if (opt_verbose > 1)
         fprintf (stderr, "got line `%s'\n", recv_line);
         fprintf (stderr, "got line `%s'\n", recv_line);
+      if (recv_type == LINE_STAT)
+        handle_status_line (p);
     }
   while (recv_type != LINE_OK && recv_type != LINE_ERR);
   if (recv_type != LINE_ERR)
     }
   while (recv_type != LINE_OK && recv_type != LINE_ERR);
   if (recv_type != LINE_ERR)
@@ -612,6 +708,26 @@ cmd_expect_err (const char *assign_to, char *arg)
 }
 
 static void
 }
 
 static void
+cmd_count_status (const char *assign_to, char *arg)
+{
+  char *p;
+
+  if (!*assign_to || !*arg)
+    die ("syntax error: count-status requires an argument and a variable");
+
+  for (p=arg; *p && !spacep (p); p++)
+    ;
+  if (*p)
+    {
+      for (*p++ = 0; spacep (p); p++)
+        ;
+      if (*p)
+        die ("cmpfiles: syntax error");
+    }
+  set_type_var (assign_to, arg, VARTYPE_COUNTER);
+}
+
+static void
 cmd_openfile (const char *assign_to, char *arg)
 {
   int fd;
 cmd_openfile (const char *assign_to, char *arg)
 {
   int fd;
@@ -624,7 +740,7 @@ cmd_openfile (const char *assign_to, char *arg)
     die ("error opening `%s': %s", arg, strerror (errno));
   
   sprintf (numbuf, "%d", fd);
     die ("error opening `%s': %s", arg, strerror (errno));
   
   sprintf (numbuf, "%d", fd);
-  set_fd_var (assign_to, numbuf, 1);
+  set_type_var (assign_to, numbuf, VARTYPE_FD);
 }
 
 static void
 }
 
 static void
@@ -640,7 +756,7 @@ cmd_createfile (const char *assign_to, char *arg)
     die ("error creating `%s': %s", arg, strerror (errno));
 
   sprintf (numbuf, "%d", fd);
     die ("error creating `%s': %s", arg, strerror (errno));
 
   sprintf (numbuf, "%d", fd);
-  set_fd_var (assign_to, numbuf, 1);
+  set_type_var (assign_to, numbuf, VARTYPE_FD);
 }
 
 
 }
 
 
@@ -648,7 +764,7 @@ static void
 cmd_pipeserver (const char *assign_to, char *arg)
 {
   if (!*arg)
 cmd_pipeserver (const char *assign_to, char *arg)
 {
   if (!*arg)
-    arg = "../sm/gpgsm";
+    die ("syntax error: servername missing");
 
   start_server (arg);
 }
 
   start_server (arg);
 }
@@ -751,6 +867,7 @@ interpreter (char *line)
     { "send"      , cmd_send },
     { "expect-ok" , cmd_expect_ok },
     { "expect-err", cmd_expect_err },
     { "send"      , cmd_send },
     { "expect-ok" , cmd_expect_ok },
     { "expect-err", cmd_expect_err },
+    { "count-status", cmd_count_status },
     { "openfile"  , cmd_openfile },
     { "createfile", cmd_createfile },
     { "pipeserver", cmd_pipeserver },
     { "openfile"  , cmd_openfile },
     { "createfile", cmd_createfile },
     { "pipeserver", cmd_pipeserver },
@@ -783,7 +900,6 @@ interpreter (char *line)
           return 0; /* empty or comment */
         }
     }
           return 0; /* empty or comment */
         }
     }
-
   for (p=line; *p && !spacep (p) && *p != '='; p++)
     ;
   if (*p == '=')
   for (p=line; *p && !spacep (p) && *p != '='; p++)
     ;
   if (*p == '=')
@@ -871,7 +987,9 @@ main (int argc, char **argv)
       if (*p != '-')
         break;
       if (!strcmp (p, "--verbose"))
       if (*p != '-')
         break;
       if (!strcmp (p, "--verbose"))
-        opt_verbose = 1;
+        opt_verbose++;
+      else if (!strcmp (p, "--no-echo"))
+        opt_no_echo++;
       else if (*p == '-' && p[1] == 'D')
         {
           p += 2;
       else if (*p == '-' && p[1] == 'D')
         {
           p += 2;
diff --git a/tests/inittests b/tests/inittests
new file mode 100755 (executable)
index 0000000..1de903e
--- /dev/null
@@ -0,0 +1,89 @@
+#!/bin/sh
+#      Copyright (C) 2002 Free Software Foundation, Inc.
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+set -e
+
+sample_cert='
+cert_g10code_test1.pem
+cert_g10code_pete1.pem
+cert_g10code_theo1.pem
+'
+
+private_keys='
+32100C27173EF6E9C4E9A25D3D69F86D37A4F939
+'
+
+clean_files='
+gpgsm.conf gpg-agent.conf trustlist.txt keyring.kbx
+msg msg.sig msg.unsig
+'
+
+
+[ -z "$srcdir" ] && srcdir=.
+[ -z "$GPGSM" ] && GPGSM=../sm/gpgsm
+
+if [ -d $srcdir/samplekeys ] \
+   && grep TESTS_ENVIRONMENT Makefile >/dev/null 2>&1; then
+ :
+else
+    echo "inittests: please cd to the tests directory first" >&2
+    exit 1
+fi
+
+if [ "$1" = "--clean" ]; then
+    if [ -d private-keys-v1.d ]; then
+       rm private-keys-v1.d/* 2>/dev/null || true
+       rmdir private-keys-v1.d
+    fi
+    rm ${clean_files} 2>/dev/null || true
+    exit 0
+fi
+
+if [ "$GNUPGHOME" != "`pwd`" ]; then
+    echo "inittests: please set GNUPGHOME to the test directory" >&2
+    exit 1
+fi
+
+if [ -n "$GPG_AGENT_INFO" ]; then
+    echo "inittests: please unset GPG_AGENT_INFO" >&2
+    exit 1
+fi
+
+
+
+# Create the private key directy if it does not exists and copy 
+# the sample keys.
+[ -d private-keys-v1.d ] || mkdir private-keys-v1.d
+for i in ${private_keys}; do 
+    cp ${srcdir}/samplekeys/$i.key private-keys-v1.d/$i.key
+done
+
+# Create the configuration scripts
+cat > gpgsm.conf <<EOF
+no-secmem-warning
+disable-crl-checks
+agent-program ../agent/gpg-agent
+EOF
+
+cat > gpg-agent.conf <<EOF
+no-grab
+pinentry-program /home/wk/work/pinentry/gtk/pinentry-gtk
+EOF
+
+cat > trustlist.txt <<EOF
+# CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=Düsseldorf,C=DE
+3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E S
+EOF
+
+# Make sure that the sample certs are available
+for i in ${sample_certs}; do 
+    $GPGSM --import ${srcdir}/samplekeys/$i.pem 
+done
diff --git a/tests/runtest b/tests/runtest
new file mode 100755 (executable)
index 0000000..6284179
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+unset GPG_AGENT_INFO
+[ -x "$1" ] && exec "$1"
+exec ./asschk --no-echo -DGPGSM=${GPGSM} <"$1"
+
diff --git a/tests/samplekeys/32100C27173EF6E9C4E9A25D3D69F86D37A4F939.key b/tests/samplekeys/32100C27173EF6E9C4E9A25D3D69F86D37A4F939.key
new file mode 100644 (file)
index 0000000..cf0535f
--- /dev/null
@@ -0,0 +1,18 @@
+(private-key
+ (oid.1.2.840.113549.1.1.1
+  (n #00e0ce96f90b6c9e02f3922beada93fe50a875eac6bcc18bb9a9cf2e84965caa2d1ff95a7f542465c6c0c19d276e4526ce048868a7a914fd343cc3a87dd74291ffc565506d5bbb25cbac6a0e2dd1f8bcaab0d4a29c2f37c950f363484bf269f7891440464baf79827e03a36e70b814938eebdc63e964247be75dc58b014b7ea251#)
+  (e #010001#)
+  (d #046129F2489D71579BE0A75FE029BD6CDB574EBF57EA8A5B0FDA942CAB943B117D7BB95E5D28875E0F9FC5FCC06A72F6D502464DABDED78EF6B716177B83D5BDC543DC5D3FED932E59F5897E92E6F58A0F33424106A3B6FA2CBF877510E4AC21C3EE47851E97D12996222AC3566D4CCB0B83D164074ABF7DE655FC2446DA1781#)
+  (p #00e861b700e17e8afe6837e7512e35b6ca11d0ae47d8b85161c67baf64377213fe52d772f2035b3ca830af41d8a4120e1c1c70d12cc22f00d28d31dd48a8d424f1#)
+  (q #00f7a7ca5367c661f8e62df34f0d05c10c88e5492348dd7bddc942c9a8f369f935a07785d2db805215ed786e4285df1658eed3ce84f469b81b50d358407b4ad361#)
+  (u #304559a9ead56d2309d203811a641bb1a09626bc8eb36fffa23c968ec5bd891eebbafc73ae666e01ba7c8990bae06cc2bbe10b75e69fcacb353a6473079d8e9b#)
+ )
+)
+
+
+
+
+
+
+
+
index 549bccd..014126f 100644 (file)
@@ -1,15 +1,16 @@
 # sm-sign+verify 
 #
 # sm-sign+verify 
 #
-# Requirements: a plain file "msg" and standard key setup
+# Creating a signature and verifying it
+# Requirements: a plain file "text-1.txt" 
 
 
-echo Creating a signature and verifying it
+plaintext = text-1.txt
 
 
-in  = openfile msg
+in  = openfile $plaintext
 out = createfile msg.sig
 in2 = openfile msg.sig
 out2 = createfile msg.unsig
 
 out = createfile msg.sig
 in2 = openfile msg.sig
 out2 = createfile msg.unsig
 
-pipeserver /usr/local/bin/gpgsm
+pipeserver $GPGSM
 send INPUT FD=$in
 expect-ok
 send OUTPUT FD=$out
 send INPUT FD=$in
 expect-ok
 send OUTPUT FD=$out
@@ -23,9 +24,13 @@ send INPUT FD=$in2
 expect-ok
 send OUTPUT FD=$out2
 expect-ok
 expect-ok
 send OUTPUT FD=$out2
 expect-ok
+goodsig = count-status GOODSIG
+trusted = count-status TRUST_FULLY
 send VERIFY
 expect-ok
 send VERIFY
 expect-ok
-
+echo goodsig=$goodsig trusted=$trusted
+fail-if !$goodsig
+fail-if !$trusted
 send BYE
 expect-ok
 
 send BYE
 expect-ok
 
@@ -35,24 +40,33 @@ out =
 in2 = 
 out2=
 
 in2 = 
 out2=
 
-cmpfiles msg msg.unsig
+cmpfiles $plaintext msg.unsig
 fail-if !$?
 
 fail-if !$?
 
-# Lets check it again with a new server instance.
+# 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
 in = openfile msg.sig
 out = createfile msg.unsig
-pipeserver /usr/local/bin/gpgsm
+pipeserver $GPGSM
 send INPUT FD=$in
 expect-ok
 send OUTPUT FD=$out
 expect-ok
 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
 send VERIFY
 expect-ok
+echo goodsig=$goodsig trusted=$trusted
+fail-if !$goodsig
+fail-if !$trusted
 
 
-cmpfiles msg msg.unsig
+cmpfiles $plaintext msg.unsig
 fail-if !$?
 
 fail-if !$?
 
+send BYE
+expect-ok
+
 
 
-echo fine, it works
 quit
 
 quit
 
diff --git a/tests/sm-verify b/tests/sm-verify
new file mode 100644 (file)
index 0000000..6abc81b
--- /dev/null
@@ -0,0 +1,112 @@
+# sm-verify 
+#
+# Verify a few distributed signatures.
+# Requirements: 
+#
+
+# Check an opaque signature
+sig = openfile text-1.osig.pem
+out = createfile msg.unsig
+pipeserver $GPGSM
+send INPUT FD=$sig
+expect-ok
+send OUTPUT FD=$out
+expect-ok
+badsig  = count-status BADSIG
+goodsig = count-status GOODSIG
+trusted = count-status TRUST_FULLY
+send VERIFY
+expect-ok
+echo badsig=$badsig goodsig=$goodsig trusted=$trusted
+fail-if $badsig
+fail-if !$goodsig
+fail-if !$trusted
+send BYE
+expect-ok
+
+sig =
+out =
+cmpfiles text-1.txt msg.unsig
+fail-if !$?
+
+# Check a detached signature.
+sig = openfile text-1.dsig.pem
+plain = openfile text-1.txt
+pipeserver $GPGSM
+send INPUT FD=$sig
+expect-ok
+send MESSAGE FD=$plain
+expect-ok
+badsig  = count-status BADSIG
+goodsig = count-status GOODSIG
+trusted = count-status TRUST_FULLY
+send VERIFY
+expect-ok
+echo badsig=$badsig goodsig=$goodsig trusted=$trusted
+fail-if $badsig
+fail-if !$goodsig
+fail-if !$trusted
+send BYE
+expect-ok
+
+# Check a tampered opaque message
+sig = openfile text-1.osig-bad.pem
+out = createfile msg.unsig
+
+pipeserver $GPGSM
+send INPUT FD=$sig
+expect-ok
+send OUTPUT FD=$out
+expect-ok
+badsig  = count-status BADSIG
+goodsig = count-status GOODSIG
+trusted = count-status TRUST_FULLY
+send VERIFY
+expect-ok
+echo badsig=$badsig goodsig=$goodsig trusted=$trusted
+fail-if $goodsig
+fail-if !$badsig
+fail-if $trusted
+send BYE
+expect-ok
+
+# Check another opaque signature but without asking for the output.
+sig = openfile text-2.osig.pem
+
+pipeserver $GPGSM
+send INPUT FD=$sig
+expect-ok
+badsig  = count-status BADSIG
+goodsig = count-status GOODSIG
+trusted = count-status TRUST_FULLY
+send VERIFY
+expect-ok
+echo badsig=$badsig goodsig=$goodsig trusted=$trusted
+fail-if $badsig
+fail-if !$goodsig
+fail-if !$trusted
+send BYE
+expect-ok
+
+# We als have tampered version.
+sig = openfile text-2.osig-bad.pem
+
+pipeserver $GPGSM
+send INPUT FD=$sig
+expect-ok
+badsig  = count-status BADSIG
+goodsig = count-status GOODSIG
+trusted = count-status TRUST_FULLY
+send VERIFY
+expect-ok
+echo badsig=$badsig goodsig=$goodsig trusted=$trusted
+fail-if $goodsig
+fail-if !$badsig
+fail-if $trusted
+send BYE
+expect-ok
+
+
+quit
+
+
diff --git a/tests/text-1.dsig.pem b/tests/text-1.dsig.pem
new file mode 100644 (file)
index 0000000..a031ec2
--- /dev/null
@@ -0,0 +1,27 @@
+-----BEGIN SIGNED MESSAGE-----
+MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAA
+oIIDGTCCAxUwggJ+oAMCAQICAQAwDQYJKoZIhvcNAQEEBQAwazELMAkGA1UEBhMC
+REUxEzARBgNVBAcUCkT8c3NlbGRvcmYxFjAUBgNVBAoTDWcxMCBDb2RlIEdtYkgx
+GTAXBgNVBAsTEEFlZ3lwdGVuIFByb2plY3QxFDASBgNVBAMTC3Rlc3QgY2VydCAx
+MB4XDTAxMTIwMzA5MzYzOFoXDTAyMTIwMzA5MzYzOFowazELMAkGA1UEBhMCREUx
+EzARBgNVBAcUCkT8c3NlbGRvcmYxFjAUBgNVBAoTDWcxMCBDb2RlIEdtYkgxGTAX
+BgNVBAsTEEFlZ3lwdGVuIFByb2plY3QxF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ZcKgylfpEkqSz4RU6qNid+0NtjSAxi
+5164wjMLG71U9qSBX4XDdDQPHpH+PPF/8021kne2kPfeP68NiXK8CagdIqlnuJEj
+K934mVre7AIjrXqoob1ipUtCWeK+2uHXsUjtUn3u1Y3eWVZ6+1hDTAAAAAAAAA==
+-----END SIGNED MESSAGE-----
diff --git a/tests/text-1.osig-bad.pem b/tests/text-1.osig-bad.pem
new file mode 100644 (file)
index 0000000..0b5f4a4
--- /dev/null
@@ -0,0 +1,45 @@
+The text in this message has been tampered.
+
+-----BEGIN SIGNED MESSAGE-----
+MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAaCAJIAEggPh
+SGlnaCBQcmllc3Q6CUFybWFtZW50cyBDaGFwdGVyIE9uZSwgdmVyc2VzIG5pbmUgdGhyb3Vn
+aCB0d2VudHktc2V2ZW46CkJyby4gTWF5bmFyZDoJQW5kIFNhaW50IEF0dGlsYSByYWlzZWQg
+dGhlIEhvbHkgSGFuZCBHcmVuYWRlIHVwIG9uIGhpZ2gKCXNheWluZywgIk9oIExvcmQsIEJs
+ZXNzIHVzIHRoaXMgSG9seSBIYW5kIEdyZW5hZGUsIGFuZCB3aXRoIGl0CglzbWFzaCBvdXIg
+ZW5lbWllcyB0byB0aW55IGJpdHMuIiAgQW5kIHRoZSBMb3JkIGRpZCBncmluLCBhbmQgdGhl
+CglwZW9wbGUgZGlkIGZlYXN0IHVwb24gdGhlIGxhbWJzLCBhbmQgc3RvYXRzLCBhbmQgb3Jh
+bmd1dGFucywgYW5kCglicmVha2Zhc3QgY2VyZWFscywgYW5kIGxpbWEgYmVhbi0KSGlnaCBQ
+cmllc3Q6CVNraXAgYSBiaXQsIHNpc3Rlci4gCkJyby4gTWF5bmFyZDoJQW5kIHRoZW4gdGhl
+IExvcmQgc3Bha2UsIHNheWluZzogIkZpcnN0LCBzaGFsdCB0aG91IHRha2UKCW91dCB0aGUg
+aG9seSBwaW4uICBUaGVuIHN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+BDhOqaaACVKUdmNW6xYJAFo53tQxbBTZ12woctFLbLm9rs/F6Tz2JIA9GxpXInkKYdvkaVHb
+pvEQgeoezFc4fd4yB87kgq4zZTViFcCJ3OvjboCu9ltIeIn73AAAAAAAAA==
+-----END SIGNED MESSAGE-----
diff --git a/tests/text-1.osig.pem b/tests/text-1.osig.pem
new file mode 100644 (file)
index 0000000..7317350
--- /dev/null
@@ -0,0 +1,48 @@
+-----BEGIN SIGNED MESSAGE-----
+MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAaCA
+JIAEggPhSGlnaCBQcmllc3Q6CUFybWFtZW50cyBDaGFwdGVyIE9uZSwgdmVyc2Vz
+IG5pbmUgdGhyb3VnaCB0d2VudHktc2V2ZW46CkJyby4gTWF5bmFyZDoJQW5kIFNh
+aW50IEF0dGlsYSByYWlzZWQgdGhlIEhvbHkgSGFuZCBHcmVuYWRlIHVwIG9uIGhp
+Z2gKCXNheWluZywgIk9oIExvcmQsIEJsZXNzIHVzIHRoaXMgSG9seSBIYW5kIEdy
+ZW5hZGUsIGFuZCB3aXRoIGl0CglzbWFzaCBvdXIgZW5lbWllcyB0byB0aW55IGJp
+dHMuIiAgQW5kIHRoZSBMb3JkIGRpZCBncmluLCBhbmQgdGhlCglwZW9wbGUgZGlk
+IGZlYXN0IHVwb24gdGhlIGxhbWJzLCBhbmQgc3RvYXRzLCBhbmQgb3Jhbmd1dGFu
+cywgYW5kCglicmVha2Zhc3QgY2VyZWFscywgYW5kIGxpbWEgYmVhbi0KSGlnaCBQ
+cmllc3Q6CVNraXAgYSBiaXQsIGJyb3RoZXIuCkJyby4gTWF5bmFyZDoJQW5kIHRo
+ZW4gdGhlIExvcmQgc3Bha2UsIHNheWluZzogIkZpcnN0LCBzaGFsdCB0aG91IHRh
+a2UKCW91dCB0aGUgaG9seSBwaW4uICBUaGVuIHNoYWx0IHRob3UgY291bnQgdG8g
+dGhyZWUuICBObyBtb3JlLC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LbLm9rs/F6Tz2JIA9GxpXInkKYdvkaVHb
+pvEQgeoezFc4fd4yB87kgq4zZTViFcCJ3OvjboCu9ltIeIn73AAAAAAAAA==
+-----END SIGNED MESSAGE-----
diff --git a/tests/text-1.txt b/tests/text-1.txt
new file mode 100644 (file)
index 0000000..b14c1a2
--- /dev/null
@@ -0,0 +1,17 @@
+High Priest:   Armaments Chapter One, verses nine through twenty-seven:
+Bro. Maynard:  And Saint Attila raised the Holy Hand Grenade up on high
+       saying, "Oh Lord, Bless us this Holy Hand Grenade, and with it
+       smash our enemies to tiny bits."  And the Lord did grin, and the
+       people did feast upon the lambs, and stoats, and orangutans, and
+       breakfast cereals, and lima bean-
+High Priest:   Skip a bit, brother.
+Bro. Maynard:  And then the Lord spake, saying: "First, shalt thou take
+       out the holy pin.  Then shalt thou count to three.  No more, no less.
+       *Three* shall be the number of the counting, and the number of the
+       counting shall be three.  *Four* shalt thou not count, and neither
+       count thou two, excepting that thou then goest on to three.  Five is
+       RIGHT OUT.  Once the number three, being the third number be reached,
+       then lobbest thou thy Holy Hand Grenade towards thy foe, who, being
+       naughty in my sight, shall snuff it.  Amen.
+All:   Amen.
+               -- Monty Python, "The Holy Hand Grenade"
diff --git a/tests/text-2.osig-bad.pem b/tests/text-2.osig-bad.pem
new file mode 100644 (file)
index 0000000..5558448
--- /dev/null
@@ -0,0 +1,28 @@
+The signature time in this message has been tampered.
+
+-----BEGIN SIGNED MESSAGE-----
+MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAaCAJIAEU01p
+bGl0YXJ5IGludGVsbGlnZW5jZSBpcyBhIGNvbnRyYWRpY3Rpb24gaW4gdGVybXMuCiAgICAg
+ICAgICAgICAgICAtLSBHcm91Y2hvIE1hcngKAAAAAAAAoIIDGTCCAxUwggJ+oAMCAQICAQAw
+DQYJKoZIhvcNAQEEBQAwazELMAkGA1UEBhMCREUxEzARBgNVBAcUCkT8c3NlbGRvcmYxFj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RYwFAYDVQQKEw1nMTAgQ29kZSBHbWJIMRkwFwYDVQQLExBBZWd5
+cHRlbiBQcm9qZWN0MRQwEgYDVQQDEwt0ZXN0IGNlcnQgMQIBADAHBgUrDgMCGqBDMBwGCSqG
+SIb3DQEJBTEPFw0wMjA4MDcxMjM4MjJaMCMGCSqGSIb3DQEJBDEWBBSzI9M4i+WJMTDoCeLu
+lJP7p1PCezALBgkqhkiG9w0BAQEEgYAqoJR3uJkChUhaH0EH3U5JpQApIhVEqedaKPT6BCPP
+WALFPzEa6YKzftA5e+Dap41UnB8nQ9rfwYty3hw5EulzV9iLnhGornQIgI6D5o7ymxyacsiY
+EarezxGXjuPMnyXcpTOgt+vz2k3qisjzxU32zpsOuK6U82PSHysX8rH9QgAAAAAAAA==
+-----END SIGNED MESSAGE-----
diff --git a/tests/text-2.osig.pem b/tests/text-2.osig.pem
new file mode 100644 (file)
index 0000000..57b5da9
--- /dev/null
@@ -0,0 +1,29 @@
+-----BEGIN SIGNED MESSAGE-----
+MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAaCA
+JIAEU01pbGl0YXJ5IGludGVsbGlnZW5jZSBpcyBhIGNvbnRyYWRpY3Rpb24gaW4g
+dGVybXMuCiAgICAgICAgICAgICAgICAtLSBHcm91Y2hvIE1hcngKAAAAAAAAoIID
+GTCCAxUwggJ+oAMCAQICAQAwDQYJKoZIhvcNAQEEBQAwazELMAkGA1UEBhMCREUx
+EzARBgNVBAcUCkT8c3NlbGRvcmYxFjAUBgNVBAoTDWcxMCBDb2RlIEdtYkgxGTAX
+BgNVBAsTEEFlZ3lwdGVuIFByb2plY3QxFDASBgNVBAMTC3Rlc3QgY2VydCAxMB4X
+DTAxMTIwMzA5MzYzOFoXDTAyMTIwMzA5MzYzOFowazELMAkGA1UEBhMCREUxEzAR
+BgNVBAcUCkT8c3NlbGRvcmYxFjAUBgNVBAoTDWcxMCBDb2RlIEdtYkgxGTAXBgNV
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
+AQEEgYAqoJR3uJkChUhaH0EH3U5JpQApIhVEqedaKPT6BCPPWALFPzEa6YKzftA5
+e+Dap41UnB8nQ9rfwYty3hw5EulzV9iLnhGornQIgI6D5o7ymxyacsiYEarezxGX
+juPMnyXcpTOgt+vz2k3qisjzxU32zpsOuK6U82PSHysX8rH9QgAAAAAAAA==
+-----END SIGNED MESSAGE-----
diff --git a/tests/text-2.txt b/tests/text-2.txt
new file mode 100644 (file)
index 0000000..314c7a4
--- /dev/null
@@ -0,0 +1,2 @@
+Military intelligence is a contradiction in terms.
+                -- Groucho Marx
diff --git a/tests/text-3.txt b/tests/text-3.txt
new file mode 100644 (file)
index 0000000..9345b55
--- /dev/null
@@ -0,0 +1,2 @@
+Military justice is to justice what military music is to music.
+               -- Groucho Marx