Add gpgsm server command GETINFO agent-check.
[gnupg.git] / tests / openpgp / clearsig.test
blob74631e180446c4ab35266eef6fb7fdaf10c6a14b
1 #!/bin/sh
2 # Copyright 1998,1999,2000,2001,2002,2003,2004,2005,2006,
3 # 2007 Free Software Foundation, Inc.
4 # This file is free software; as a special exception the author gives
5 # unlimited permission to copy and/or distribute it, with or without
6 # modifications, as long as this notice is preserved. This file is
7 # distributed in the hope that it will be useful, but WITHOUT ANY
8 # WARRANTY, to the extent permitted by law; without even the implied
9 # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # Fixme: we should not only do a --verify but also the output.
13 . $srcdir/defs.inc || exit 3
15 # ======================================
16 # I can't compare the out because plain-3 has no LF as last charcater
17 # but the output has always one. I do not thinkl this is a bug, because
18 # it is clear text and not binary text.
19 # ======================================
20 for i in $plain_files plain-large ; do
21 echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes $i
22 $GPG --verify x
23 done
26 # ======================================
27 # and once more to check rfc1991
28 # ======================================
30 if have_pubkey_algo "RSA"; then
31 for i in $plain_files plain-large ; do
32 $GPG -u $usrname3 --rfc1991 --digest-algo md5 --clearsign -o x --yes $i
33 $GPG --verify x
34 done
37 # ======================================
38 # and one with long lines
39 # ======================================
40 cat >y <<EOF
41 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyx
43 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
44 EOF
45 echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
46 $GPG --verify x
49 # ======================================
50 # and one with only one long lines
51 # ======================================
52 cat >y <<EOF
53 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyx
54 EOF
55 echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
56 $GPG --verify x
59 # ======================================
60 # and one with an empty body
61 # ======================================
62 cat >y <<EOF
63 EOF
64 echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
65 $GPG --verify x
68 # ======================================
69 # and one with one empty line at the end
70 # ======================================
71 cat >y <<EOF
72 line 1
73 line 2
74 line 3
75 there is a blank line after this
77 EOF
78 echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
79 $GPG --verify x
82 # ======================================
83 # I think this file will be constructed wrong (gpg 0.9.3)
84 # but it should verify okay anyway.
85 # ======================================
86 echo "this is a sig test" >y
87 echo_n " " >>y
88 echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
89 $GPG --verify x
92 # ======================================
93 # check our special diff mode
94 # ======================================
95 cat >y <<EOF
96 --- mainproc.c Tue Jun 27 09:28:11 2000
97 +++ mainproc.c~ Thu Jun 8 22:50:25 2000
98 @@ -1190,16 +1190,13 @@
99 md_enable( c->mfx.md, n1->pkt->pkt.signature->digest_algo);
101 /* ask for file and hash it */
102 - if( c->sigs_only ) {
103 + if( c->sigs_only )
104 rc = hash_datafiles( c->mfx.md, NULL,
105 c->signed_data, c->sigfilename,
106 n1? (n1->pkt->pkt.onepass_sig->sig_class == 0x01):0 );
108 echo "$usrpass1" | $GPG --passphrase-fd 0 \
109 --not-dash-escaped --clearsign -o x --yes y
110 $GPG --verify x