summaryrefslogtreecommitdiffstats
path: root/checks
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-02-26 17:56:31 +0100
committerWerner Koch <wk@gnupg.org>1998-02-26 17:56:31 +0100
commit4e8c3794b313cea388869de5aced8ec9baaa1a16 (patch)
tree88b0b4dbad1d65c6c385bb7ccab5b6e6841c7026 /checks
parentRenamed to GNUPG (diff)
downloadgnupg2-4e8c3794b313cea388869de5aced8ec9baaa1a16.tar.xz
gnupg2-4e8c3794b313cea388869de5aced8ec9baaa1a16.zip
release 0.2.9
Diffstat (limited to 'checks')
-rw-r--r--checks/Makefile.am36
-rwxr-xr-xchecks/armdetach.test11
-rwxr-xr-xchecks/armdetachm.test9
-rwxr-xr-xchecks/armencrypt.test11
-rwxr-xr-xchecks/armencryptp.test12
-rwxr-xr-xchecks/armsignencrypt.test13
-rwxr-xr-xchecks/armsigs.test11
-rwxr-xr-xchecks/checkit213
-rwxr-xr-xchecks/clearsig.test20
-rwxr-xr-xchecks/decrypt.test10
-rwxr-xr-xchecks/defs.inc79
-rwxr-xr-xchecks/detach.test10
-rwxr-xr-xchecks/detachm.test9
-rwxr-xr-xchecks/encrypt.test11
-rwxr-xr-xchecks/encryptp.test10
-rwxr-xr-xchecks/genkey1024.test59
-rwxr-xr-xchecks/signencrypt.test13
-rwxr-xr-xchecks/sigs.test11
-rwxr-xr-xchecks/version.test10
19 files changed, 344 insertions, 214 deletions
diff --git a/checks/Makefile.am b/checks/Makefile.am
index 2d999a502..bf8202cdf 100644
--- a/checks/Makefile.am
+++ b/checks/Makefile.am
@@ -1,9 +1,43 @@
## Process this file with automake to create Makefile.in
-TESTS = checkit
+TESTS = version.test decrypt.test clearsig.test armsigs.test \
+ sigs.test armencrypt.test armencryptp.test \
+ encrypt.test encryptp.test signencrypt.test \
+ armsignencrypt.test armdetach.test detach.test \
+ armdetachm.test detachm.test genkey1024.test
+
TEST_FILES = pubring.asc secring.asc gnupg.asc plain-1 plain-2 plain-3o.asc \
plain-1.asc plain-2.asc plain-3.asc
+DATA_FILES = data-500 data-9000 data-32000 data-80000
+
EXTRA_DIST = $(TESTS) $(TEST_FILES)
+CLEANFILES = prepared.stamp x y z out err $(DATA_FILES)
+
+check: prepared.stamp
+
+prepared.stamp: pubring.gpg secring.gpg gnupg.sig plain-3 $(DATA_FILES)
+ @set -x; \
+ echo "def" | ../g10/gpg -v --no-operation; \
+ echo timestamp >./prepared.stamp
+
+pubring.gpg: pubring.asc
+ ../g10/gpgm --yes --dearmor -o pubring.gpg pubring.asc
+secring.gpg: secring.asc
+ ../g10/gpgm --yes --dearmor -o secring.gpg secring.asc
+gnupg.sig: gnupg.asc
+ ../g10/gpgm --yes --dearmor -o gnupg.sig gnupg.asc
+plain-3: plain-3o.asc
+ ../g10/gpgm --yes --dearmor -o plain-3 plain-3o.asc
+
+data-500:
+ head -c 500 /dev/urandom >data-500
+data-9000:
+ head -c 9000 /dev/urandom >data-9000
+data-32000:
+ head -c 32000 /dev/urandom >data-32000
+data-80000:
+ head -c 80000 /dev/urandom >data-80000
+
diff --git a/checks/armdetach.test b/checks/armdetach.test
new file mode 100755
index 000000000..f09fc2b40
--- /dev/null
+++ b/checks/armdetach.test
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+
+#info Checking armored detached signatures
+for i in $plain_files $data_files ; do
+ echo "$usrpass1" | run_gpg --passphrase-fd 0 -sab -o x --yes $i
+ run_gpg -o /dev/null --yes x <$i || error "$i: bad signature"
+done
+
diff --git a/checks/armdetachm.test b/checks/armdetachm.test
new file mode 100755
index 000000000..eb245aabb
--- /dev/null
+++ b/checks/armdetachm.test
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking armored detached signatures of multiple files
+i="$plain_files $data_files"
+echo "$usrpass1" | run_gpg --passphrase-fd 0 -sab -o x --yes $i
+cat $i | run_gpg -o /dev/null --yes x || error "$i: bad signature"
+
diff --git a/checks/armencrypt.test b/checks/armencrypt.test
new file mode 100755
index 000000000..5ab80fe9e
--- /dev/null
+++ b/checks/armencrypt.test
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking armored encryption
+for i in $plain_files $data_files ; do
+ run_gpg -ea -o x --yes -r "$usrname2" $i
+ run_gpg -o y --yes x
+ cmp $i y || error "$i: mismatch"
+done
+
diff --git a/checks/armencryptp.test b/checks/armencryptp.test
new file mode 100755
index 000000000..a67e3c7e4
--- /dev/null
+++ b/checks/armencryptp.test
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking armored encryption with a pipe
+for i in $plain_files $data_files ; do
+ run_gpg -ea --yes -r "$usrname2" < $i | tee x | run_gpg -o y --yes
+ cmp $i y || error "$i: mismatch"
+ run_gpg --yes < x > y
+ cmp $i y || error "$i: mismatch"
+done
+
diff --git a/checks/armsignencrypt.test b/checks/armsignencrypt.test
new file mode 100755
index 000000000..3b87b2580
--- /dev/null
+++ b/checks/armsignencrypt.test
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+
+#info Checking armored signing and encryption
+for i in $plain_files $data_files ; do
+ echo "$usrpass1" \
+ | run_gpg --passphrase-fd 0 -sae -o x --yes -r "$usrname2" $i
+ run_gpg -o y --yes x
+ cmp $i y || error "$i: mismatch"
+done
+
diff --git a/checks/armsigs.test b/checks/armsigs.test
new file mode 100755
index 000000000..16b709685
--- /dev/null
+++ b/checks/armsigs.test
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking armored signatures
+for i in $plain_files $data_files ; do
+ echo "$usrpass1" | run_gpg --passphrase-fd 0 -sa -o x --yes $i
+ run_gpg -o y --yes x
+ cmp $i y || error "$i: mismatch"
+done
+
diff --git a/checks/checkit b/checks/checkit
deleted file mode 100755
index 7da825afe..000000000
--- a/checks/checkit
+++ /dev/null
@@ -1,213 +0,0 @@
-#!/bin/bash
-# Script for G10 testing
-#---------------------------------------------------------
-
-#--------------------------------
-#------ constants ---------------
-#--------------------------------
-
-usrname1="one"
-usrpass1="def"
-usrname2="two"
-usrpass2=""
-plain_files="plain-1 plain-2"
-data_files=""
-exp_files=""
-
-
-#--------------------------------
-#------ utility functions -------
-#--------------------------------
-
-fatal () {
- echo "$pgmname: fatal:" $* >&2
- exit 1;
-}
-
-error () {
- echo "$pgmname:" $* >&2
- exit 1
-}
-
-info () {
- echo "$pgmname:" $* >&2
-}
-
-chdir () {
- cd $1 || fatal "cannot cd to $1"
-}
-
-cleanup () {
- rm $data_files x y z 2>/dev/null
- echo "#empty" >./options
-}
-
-
-run_g10 () {
- if ! eval ../g10/gpg --homedir . $* ; then
- echo "(../g10/gpg --homedir . $*) failed" >&2
- exit 1
- fi
-}
-
-run_g10maint () {
- if ! eval ../g10/gpgm --homedir . $* ; then
- echo "(../g10/gpgm --homedir . $*) failed" >&2
- exit 1
- fi
-}
-
-#--------------------------------
-#-------- main program ----------
-#--------------------------------
-
-set -e
-pgmname=$(basename $0)
-trap cleanup SIGHUP SIGINT SIGQUIT
-
-
-# some checks
-for i in $plain_files plain-3o.asc ; do
- [ -f $i ] || fatal "$i: missing"
-done
-for i in $exp_files; do
- [ -f $i ] || fatal "$i: script missing"
-done
-# create the keyrings
-
-cat <<EOF >./options
-no-greeting
-no-secmem-warning
-batch
-EOF
-
-# print the G10 version
-run_g10 --version
-
-info Unpacking some material
-run_g10maint --yes --dearmor -o pubring.gpg pubring.asc
-run_g10maint --yes --dearmor -o secring.gpg secring.asc
-run_g10maint --yes --dearmor -o gnupg.sig gnupg.asc
-run_g10maint --yes --dearmor -o plain-3 plain-3o.asc
-plain_files="$plain_files plain-3"
-# make sure all files are created
-echo "$usrpass1" | run_g10 --no-operation
-
-info Checking decryption
-for i in $plain_files ; do
- echo "$usrpass1" | run_g10 --passphrase-fd 0 -o y --yes $i.asc
- cmp $i y || error "$i: mismatch"
-done
-
-info Checking cleartext signatures
-# There is a minor glitch, which appends a lf to the cleartext.
-# I do not consider that a bug, but I have to use the head .. mimic.
-# It is not clear what should happen to leading LFs, we must
-# change the defintion of cleartext, so that only 1 empty line
-# must follow the headers, but some specs say: any number of empty lines ..
-# clean-sat removes leading LFs
-# I know that this does not work for random data files (due to large lines
-# or what ever) - I hope we can live with it.
-for i in $plain_files; do
- echo "$usrpass1" | run_g10 --passphrase-fd 0 -sat -o x --yes $i
- run_g10 -o y --yes x
- ../tools/clean-sat < $i > z
- head -c $[ $(cat y | wc -c) - 1 ] y | diff - z || error "$i: mismatch"
-done
-
-info Creating some random data files
-for i in 500 9000 32000 80000; do
- head -c $i /dev/urandom >data-$i
- data_files="$data_files data-$i"
-done
-
-info Checking armored signatures
-for i in $plain_files $data_files ; do
- echo "$usrpass1" | run_g10 --passphrase-fd 0 -sa -o x --yes $i
- run_g10 -o y --yes x
- cmp $i y || error "$i: mismatch"
-done
-
-info Checking signatures
-for i in $plain_files $data_files; do
- echo "$usrpass1" | run_g10 --passphrase-fd 0 -s -o x --yes $i
- run_g10 -o y --yes x
- cmp $i y || error "$i: mismatch"
-done
-
-
-info Checking armored encryption
-for i in $plain_files $data_files ; do
- run_g10 -ea -o x --yes -r "$usrname2" $i
- run_g10 -o y --yes x
- cmp $i y || error "$i: mismatch"
-done
-
-info Checking armored encryption with a pipe
-for i in $plain_files $data_files ; do
- run_g10 -ea --yes -r "$usrname2" < $i | tee x \
- | run_g10 -o y --yes
- cmp $i y || error "$i: mismatch"
- run_g10 --yes < x > y
- cmp $i y || error "$i: mismatch"
-done
-
-info Checking encryption
-for i in $plain_files $data_files ; do
- run_g10 -e -o x --yes -r "$usrname2" $i
- run_g10 -o y --yes x
- cmp $i y || error "$i: mismatch"
-done
-
-info Checking encryption with a pipe
-for i in $plain_files $data_files ; do
- run_g10 -e --yes -r "$usrname2" < $i \
- | run_g10 --yes > y
- cmp $i y || error "$i: mismatch"
-done
-
-
-info Checking signing and encryption
-for i in $plain_files $data_files ; do
- echo "$usrpass1" \
- | run_g10 --passphrase-fd 0 -se -o x --yes -r "$usrname2" $i
- run_g10 -o y --yes x
- cmp $i y || error "$i: mismatch"
-done
-
-info Checking armored signing and encryption
-for i in $plain_files $data_files ; do
- echo "$usrpass1" \
- | run_g10 --passphrase-fd 0 -sae -o x --yes -r "$usrname2" $i
- run_g10 -o y --yes x
- cmp $i y || error "$i: mismatch"
-done
-
-
-info Checking armored detached signatures
-for i in $plain_files $data_files ; do
- echo "$usrpass1" | run_g10 --passphrase-fd 0 -sab -o x --yes $i
- run_g10 -o /dev/null --yes x <$i || error "$i: bad signature"
-done
-
-info Checking detached signatures
-for i in $plain_files $data_files ; do
- echo "$usrpass1" | run_g10 --passphrase-fd 0 -sb -o x --yes $i
- run_g10 -o /dev/null --yes x <$i || error "$i: bad signature"
-done
-
-
-info Checking detached signatures of multiple files
-i="$plain_files $data_files"
-echo "$usrpass1" | run_g10 --passphrase-fd 0 -sb -o x --yes $i
-cat $i | run_g10 -o /dev/null --yes x || error "$i: bad signature"
-
-info Checking armored detached signatures of multiple files
-i="$plain_files $data_files"
-echo "$usrpass1" | run_g10 --passphrase-fd 0 -sab -o x --yes $i
-cat $i | run_g10 -o /dev/null --yes x || error "$i: bad signature"
-
-
-info "All tests passed."
-exit 0
-
diff --git a/checks/clearsig.test b/checks/clearsig.test
new file mode 100755
index 000000000..6cb8c7aeb
--- /dev/null
+++ b/checks/clearsig.test
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking cleartext signatures
+# There is a minor glitch, which appends a lf to the cleartext.
+# I do not consider that a bug, but I have to use the head .. mimic.
+# It is not clear what should happen to leading LFs, we must
+# change the defintion of cleartext, so that only 1 empty line
+# must follow the headers, but some specs say: any number of empty lines ..
+# clean-sat removes leading LFs
+# I know that this does not work for random data files (due to large lines
+# or what ever) - I hope we can live with it.
+for i in $plain_files; do
+ echo "$usrpass1" | run_gpg --passphrase-fd 0 -sat -o x --yes $i
+ run_gpg -o y --yes x
+ ../tools/clean-sat < $i > z
+ head -c $[ $(cat y | wc -c) - 1 ] y | diff - z || error "$i: mismatch"
+done
+
diff --git a/checks/decrypt.test b/checks/decrypt.test
new file mode 100755
index 000000000..e45a0ad6f
--- /dev/null
+++ b/checks/decrypt.test
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking decryption of supplied files
+for i in $plain_files ; do
+ echo "$usrpass1" | run_gpg --passphrase-fd 0 -o y --yes $i.asc
+ cmp $i y || error "$i: mismatch"
+done
+
diff --git a/checks/defs.inc b/checks/defs.inc
new file mode 100755
index 000000000..241d4a07d
--- /dev/null
+++ b/checks/defs.inc
@@ -0,0 +1,79 @@
+# definitions for the check scripts
+
+#--------------------------------
+#------ constants ---------------
+#--------------------------------
+
+# Note that usrpass1 is also used in Makefile.am
+usrname1="one"
+usrpass1="def"
+usrname2="two"
+usrpass2=""
+plain_files="plain-1 plain-2 plain-3"
+data_files="data-500 data-9000 data-32000 data-80000"
+exp_files=""
+#cleanup_files="x y z"
+
+
+#--------------------------------
+#------ utility functions -------
+#--------------------------------
+
+fatal () {
+ echo "$pgmname: fatal:" $* >&2
+ exit 1;
+}
+
+error () {
+ echo "$pgmname:" $* >&2
+ exit 1
+}
+
+info () {
+ echo "$pgmname:" $* >&2
+}
+
+chdir () {
+ cd $1 || fatal "cannot cd to $1"
+}
+
+#cleanup () {
+# rm $cleanup_files 2>/dev/null || true
+# echo "#empty" >./options
+#}
+
+
+#add_cleanup () {
+# cleanup_files="$cleanup_files $*"
+#}
+
+run_gpg () {
+ if ! eval ../g10/gpg --homedir . $* 2>err ; then
+ cat err >&2
+ echo "(../g10/gpg --homedir . $*) failed" >&2
+ exit 1
+ fi
+ grep -v 'gpg: Good signature from' err || true
+}
+
+run_gpgm () {
+ if ! eval ../g10/gpgm --homedir . $* ; then
+ echo "(../g10/gpgm --homedir . $*) failed" >&2
+ exit 1
+ fi
+}
+
+
+
+set -e
+pgmname=$(basename $0)
+#trap cleanup SIGHUP SIGINT SIGQUIT
+
+[ -z $srcdir ] && fatal "not called from make"
+
+cat <<EOF >./options
+no-greeting
+no-secmem-warning
+batch
+EOF
+
diff --git a/checks/detach.test b/checks/detach.test
new file mode 100755
index 000000000..d9f44db12
--- /dev/null
+++ b/checks/detach.test
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking detached signatures
+for i in $plain_files $data_files ; do
+ echo "$usrpass1" | run_gpg --passphrase-fd 0 -sb -o x --yes $i
+ run_gpg -o /dev/null --yes x <$i || error "$i: bad signature"
+done
+
diff --git a/checks/detachm.test b/checks/detachm.test
new file mode 100755
index 000000000..60f2e75b0
--- /dev/null
+++ b/checks/detachm.test
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking detached signatures of multiple files
+i="$plain_files $data_files"
+echo "$usrpass1" | run_gpg --passphrase-fd 0 -sb -o x --yes $i
+cat $i | run_gpg -o /dev/null --yes x || error "$i: bad signature"
+
diff --git a/checks/encrypt.test b/checks/encrypt.test
new file mode 100755
index 000000000..b6920814f
--- /dev/null
+++ b/checks/encrypt.test
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking encryption
+for i in $plain_files $data_files ; do
+ run_gpg -e -o x --yes -r "$usrname2" $i
+ run_gpg -o y --yes x
+ cmp $i y || error "$i: mismatch"
+done
+
diff --git a/checks/encryptp.test b/checks/encryptp.test
new file mode 100755
index 000000000..8dc0bb0d2
--- /dev/null
+++ b/checks/encryptp.test
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking encryption with a pipe
+for i in $plain_files $data_files ; do
+ run_gpg -e --yes -r "$usrname2" < $i | run_gpg --yes > y
+ cmp $i y || error "$i: mismatch"
+done
+
diff --git a/checks/genkey1024.test b/checks/genkey1024.test
new file mode 100755
index 000000000..f8533919e
--- /dev/null
+++ b/checks/genkey1024.test
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+info "This expect script does yet work"
+exit 0
+
+expect - <<EOF
+set timeout -1
+match_max 100000
+spawn ../g10/gpg --no-batch --quick-random --homedir . --gen-key
+expect -exact "Please select the algorithm to use:\r
+ (1) ElGamal is the suggested one.\r
+ (2) DSA can only be used for signatures.\r
+Your selection? (1,2) "
+send -- "1\r"
+expect -exact "1\r
+\r \rAbout to generate a new ElGamal keypair.\r
+ minimum keysize is 768 bits\r
+ default keysize is 1024 bits\r
+ highest suggested keysize is 2048 bits\r
+What keysize do you want? (1024) "
+send -- "\r"
+expect -exact "\r
+\r \rRequested keysize is 1024 bits\r
+\r
+You need a User-ID to identify your key; the software constructs the user id\r
+from Real Name, Comment and Email Address in this form:\r
+ \"Heinrich Heine (Der Dichter) <heinrichh@uni-duesseldorf.de>\"\r
+\r
+Real name: "
+send -- "Harry H.\r"
+expect -exact "Harry H.\r
+\r \rEmail address: "
+send -- "hh@ddorf.de\r"
+expect -exact "hh@ddorf.de\r
+\r \rComment: "
+send -- "a test\r"
+expect -exact "a test\r
+\r \rYou selected this USER-ID:\r
+ \"Harry H. (a test) <hh@ddorf.de> (INSECURE!)\"\r
+\r
+Edit (N)ame, (C)omment, (E)mail or (O)kay? "
+send -- "o\r"
+expect -exact "o\r
+\r \rYou need a Passphrase to protect your secret key.\r
+\r
+Enter pass phrase: "
+send -- "abc\r"
+expect -ex "abc\r\n"
+expect -ex "\r \rRepeat pass phrase:\ "
+send -- "abc\r"
+expect -ex "abc\r\n"
+expect {
+ -ex "public and secret key created and signed.\r"
+ eof abort
+}
+EOF
+
diff --git a/checks/signencrypt.test b/checks/signencrypt.test
new file mode 100755
index 000000000..1cf038c56
--- /dev/null
+++ b/checks/signencrypt.test
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+
+#info Checking signing and encryption
+for i in $plain_files $data_files ; do
+ echo "$usrpass1" \
+ | run_gpg --passphrase-fd 0 -se -o x --yes -r "$usrname2" $i
+ run_gpg -o y --yes x
+ cmp $i y || error "$i: mismatch"
+done
+
diff --git a/checks/sigs.test b/checks/sigs.test
new file mode 100755
index 000000000..bc49c4c20
--- /dev/null
+++ b/checks/sigs.test
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+#info Checking signatures
+for i in $plain_files $data_files; do
+ echo "$usrpass1" | run_gpg --passphrase-fd 0 -s -o x --yes $i
+ run_gpg -o y --yes x
+ cmp $i y || error "$i: mismatch"
+done
+
diff --git a/checks/version.test b/checks/version.test
new file mode 100755
index 000000000..6d04385df
--- /dev/null
+++ b/checks/version.test
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+. defs.inc || exit 3
+
+# print the GPG version
+run_gpg --version
+cat err
+
+#fixme: check that the output is correct
+