Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / crypto / external / bsd / netpgp / dist / tst
blobddfd4b3d974a58cbbc6c96337a292b8b9e736011
1 #! /bin/sh
3 while [ $# -gt 0 ]; do
4 case "$1" in
5 -v)
6 set -x
7 ;;
8 *)
9 break
11 esac
12 shift
13 done
15 env USETOOLS=no MAKEOBJDIRPREFIX=/usr/obj/i386 sh -c 'cd ../lib && \
16 make cleandir ; \
17 su root -c "make includes"; \
18 make ; \
19 su root -c "make install"'
20 env USETOOLS=no MAKEOBJDIRPREFIX=/usr/obj/i386 sh -c 'cd ../netpgp && \
21 make cleandir ; \
22 make ; \
23 su root -c "make install"'
24 env USETOOLS=no MAKEOBJDIRPREFIX=/usr/obj/i386 sh -c 'cd ../netpgpkeys && \
25 make cleandir ; \
26 make ; \
27 su root -c "make install"'
28 env USETOOLS=no MAKEOBJDIRPREFIX=/usr/obj/i386 sh -c 'cd ../netpgpverify && \
29 make cleandir ; \
30 make ; \
31 su root -c "make install"'
33 passed=0
34 total=23
35 echo "======> sign/verify 180938 file"
36 cp configure a
37 /usr/bin/netpgp --sign a
38 /usr/bin/netpgp --verify a.gpg && passed=$(expr $passed + 1)
39 echo "======> attempt to verify an unsigned file"
40 /usr/bin/netpgp --verify a || passed=$(expr $passed + 1)
41 echo "======> encrypt/decrypt 10809 file"
42 cp src/netpgp/netpgp.1 b
43 /usr/bin/netpgp --encrypt b
44 /usr/bin/netpgp --decrypt b.gpg
45 diff src/netpgp/netpgp.1 b && passed=$(expr $passed + 1)
46 echo "======> encrypt/decrypt 180938 file"
47 cp configure c
48 /usr/bin/netpgp --encrypt c
49 /usr/bin/netpgp --decrypt c.gpg
50 diff configure c && passed=$(expr $passed + 1)
51 echo "======> encrypt/decrypt bigass file"
52 cat configure configure configure configure configure configure > d
53 ls -l d
54 cp d e
55 /usr/bin/netpgp --encrypt d
56 /usr/bin/netpgp --decrypt d.gpg
57 diff e d && passed=$(expr $passed + 1)
58 echo "======> sign/verify detached signature file"
59 cat configure configure configure configure configure configure > f
60 /usr/bin/netpgp --sign --detached f
61 ls -l f f.sig
62 /usr/bin/netpgp --verify f.sig && passed=$(expr $passed + 1)
63 echo "======> cat signature - verified cat command"
64 /usr/bin/netpgp --cat a.gpg > a2
65 diff a a2 && passed=$(expr $passed + 1)
66 echo "======> another cat signature - verified cat command"
67 /usr/bin/netpgp --cat --output=a3 a.gpg
68 diff a a3 && passed=$(expr $passed + 1)
69 echo "======> netpgp list-packets test"
70 /usr/bin/netpgp --list-packets || passed=$(expr $passed + 1)
71 echo "======> version information"
72 /usr/bin/netpgp --version
73 echo "======> netpgpverify file"
74 /usr/bin/netpgpverify a.gpg && passed=$(expr $passed + 1)
75 echo "======> attempt to verify an unsigned file"
76 /usr/bin/netpgpverify a || passed=$(expr $passed + 1)
77 echo "======> sign/verify detached signature file"
78 ls -l f f.sig
79 /usr/bin/netpgpverify f.sig && passed=$(expr $passed + 1)
80 echo "======> another verify signature - verified cat command"
81 /usr/bin/netpgpverify --output=a3 a.gpg
82 diff a a3 && passed=$(expr $passed + 1)
83 echo "======> list keys"
84 /usr/bin/netpgpkeys --list-keys && passed=$(expr $passed + 1)
85 echo "======> version information"
86 /usr/bin/netpgpverify --version
87 echo "======> find specific key information"
88 /usr/bin/netpgpkeys --get-key c0596823 agc@netbsd.org && passed=$(expr $passed + 1)
89 echo "======> ascii armoured signature"
90 cp Makefile.am g
91 /usr/bin/netpgp --sign --armor g && passed=$(expr $passed + 1)
92 echo "======> ascii armoured sig detection and verification"
93 /usr/bin/netpgp --verify g.asc && passed=$(expr $passed + 1)
94 echo "======> ascii armoured signature of large file"
95 cp Makefile.in g
96 /usr/bin/netpgp --sign --armor g && passed=$(expr $passed + 1)
97 echo "======> ascii armoured sig detection and verification of large file"
98 /usr/bin/netpgp --verify g.asc && passed=$(expr $passed + 1)
99 echo "======> list ssh host RSA public key"
100 /usr/bin/netpgpkeys --ssh-keys --sshkeyfile=/etc/ssh/ssh_host_rsa_key.pub --list-keys && passed=$(expr $passed + 1)
101 echo "======> sign/verify file with ssh host keys"
102 cp configure a
103 sudo /usr/bin/netpgp --ssh-keys --sshkeyfile=/etc/ssh/ssh_host_rsa_key.pub --sign a
104 sudo chmod 644 a.gpg
105 /usr/bin/netpgp --verify --ssh-keys --sshkeyfile=/etc/ssh/ssh_host_rsa_key.pub a.gpg && passed=$(expr $passed + 1)
106 echo "======> pipeline and memory encrypt/decrypt"
107 /usr/bin/netpgp --encrypt < a | /usr/bin/netpgp --decrypt > a4
108 diff a a4 && passed=$(expr $passed + 1)
109 echo "======> pipeline and memory sign/verify"
110 /usr/bin/netpgp --sign < a | /usr/bin/netpgp --cat > a5
111 diff a a5 && passed=$(expr $passed + 1)
112 rm -f a a.gpg b b.gpg c c.gpg d d.gpg e f f.sig g g.asc a2 a3 a4 a5
113 echo "Passed ${passed}/${total} tests"