summaryrefslogtreecommitdiff
path: root/tests/openpgp/clearsig.test
blob: 74631e180446c4ab35266eef6fb7fdaf10c6a14b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh
# Copyright 1998,1999,2000,2001,2002,2003,2004,2005,2006,
#           2007 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.

# Fixme: we should not only do a --verify but also the output.

. $srcdir/defs.inc || exit 3

# ======================================
# I can't compare the out because plain-3 has no LF as last charcater
# but the output has always one.  I do not thinkl this is a bug, because
# it is clear text and not binary text.
# ======================================
for i in $plain_files plain-large ; do
    echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes $i
    $GPG --verify x
done


# ======================================
# and once more to check rfc1991
# ======================================

if have_pubkey_algo "RSA"; then
  for i in $plain_files plain-large ; do
      $GPG -u $usrname3 --rfc1991 --digest-algo md5 --clearsign -o x --yes $i
      $GPG --verify x
  done
fi

# ======================================
# and one with long lines
# ======================================
cat >y <<EOF
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyx

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
EOF
echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
$GPG --verify x


# ======================================
# and one with only one long lines
# ======================================
cat >y <<EOF
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyx
EOF
echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
$GPG --verify x


# ======================================
# and one with an empty body
# ======================================
cat >y <<EOF
EOF
echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
$GPG --verify x


# ======================================
# and one with one empty line at the end
# ======================================
cat >y <<EOF
line 1
line 2
line 3
there is a blank line after this

EOF
echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
$GPG --verify x


# ======================================
# I think this file will be constructed wrong (gpg 0.9.3)
# but it should verify okay anyway.
# ======================================
echo "this is a sig test" >y
echo_n " " >>y
echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes y
$GPG --verify x


# ======================================
# check our special diff mode
# ======================================
cat >y <<EOF
--- mainproc.c	Tue Jun 27 09:28:11 2000
+++ mainproc.c~ Thu Jun  8 22:50:25 2000
@@ -1190,16 +1190,13 @@
		md_enable( c->mfx.md, n1->pkt->pkt.signature->digest_algo);
	    }
	    /* ask for file and hash it */
-	    if( c->sigs_only ) {
+	    if( c->sigs_only )   
		rc = hash_datafiles( c->mfx.md, NULL,
				     c->signed_data, c->sigfilename,
			n1? (n1->pkt->pkt.onepass_sig->sig_class == 0x01):0 );
EOF
echo "$usrpass1" | $GPG --passphrase-fd 0 \
				   --not-dash-escaped --clearsign -o x --yes y
$GPG --verify x