tests: Add tests for the PGP trust model.
[gnupg.git] / tests / openpgp / signed-messages.scm
1 ;; Copyright (C) 2016 g10 Code GmbH
2 ;;
3 ;; This file is part of GnuPG.
4 ;;
5 ;; GnuPG is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3 of the License, or
8 ;; (at your option) any later version.
9 ;;
10 ;; GnuPG is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ;; GNU General Public License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
17
18 ;; A plain signed message created using
19 ;;  echo abc | gpg --homedir . --passphrase-fd 0 -u Alpha -z0 -sa msg
20 (define msg_ols_asc "
21 -----BEGIN PGP MESSAGE-----
22
23 kA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGluayB0aGF0IGFsbCByaWdo
24 dC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5IGFyZSBzaWNrIGFuZAp0
25 aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkgZGVjZW50IHBlb3BsZSBh
26 cmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJlaW5nIHNpY2sgYW5kIHRp
27 cmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdtCnNpY2sgYW5kIHRpcmVk
28 IG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5IFB5dGhvbgqIPwMFAEQM
29 UlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk01pbAKCIjkzLOAmkZNm0
30 D8luT78c/1x45Q==
31 =a29i
32 -----END PGP MESSAGE-----
33 ")
34
35 ;; A plain signed message created using
36 ;;  echo abc | gpg --homedir . --passphrase-fd 0 -u Alpha -sa msg
37 (define msg_cols_asc "
38 -----BEGIN PGP MESSAGE-----
39
40 owGbwMvMwCSoW1RzPCOz3IRxLSN7EnNucboLT6Cgp0JJRmZeNpBMLFFIzMlRKMpM
41 zyjRBQtm5qUrFKTmF+SkKmTmgdQVKyTnl+aVFFUqJBalKhRnJmcrJOalcJVkFqWm
42 KOSnKSSlgrSU5OekQMzLL0rJzEsEKk9JTU7NK4EZBtKcBtRRWgAzlwtmbnlmSQbU
43 GJjxCmDj9RQUPNVzFZJTi0oSM/NyKhXy8kuAYk6lJSBxLlTF2NziqZCYq8elq+Cb
44 n1dSqRBQWZKRn8fVYc/MygAKBljYCDIFiTDMT+9seu836Q+bevyHTJ0dzPNuvCjn
45 ZpgrwX38z58rJsfYDhwOSS4SkN/d6vUAAA==
46 =s6sY
47 -----END PGP MESSAGE-----
48 ")
49
50 ;; A PGP 2 style message.
51 (define msg_sl_asc "
52 -----BEGIN PGP MESSAGE-----
53
54 iD8DBQBEDFJaLXJ8x2hpdzQRAkeCAKCZRBk2Pmx4w9h2LgosS0AppNNaWwCgiI5M
55 yzgJpGTZtA/Jbk+/HP9ceOWtAQdiA21zZ0QMUlpJIHRoaW5rIHRoYXQgYWxsIHJp
56 Z2h0LXRoaW5raW5nIHBlb3BsZSBpbiB0aGlzIGNvdW50cnkgYXJlIHNpY2sgYW5k
57 CnRpcmVkIG9mIGJlaW5nIHRvbGQgdGhhdCBvcmRpbmFyeSBkZWNlbnQgcGVvcGxl
58 IGFyZSBmZWQgdXAgaW4gdGhpcwpjb3VudHJ5IHdpdGggYmVpbmcgc2ljayBhbmQg
59 dGlyZWQuICBJJ20gY2VydGFpbmx5IG5vdC4gIEJ1dCBJJ20Kc2ljayBhbmQgdGly
60 ZWQgb2YgYmVpbmcgdG9sZCB0aGF0IEkgYW0uCi0gTW9udHkgUHl0aG9uCg==
61 =0ukK
62 -----END PGP MESSAGE-----
63 ")
64
65 ;; An OpenPGP message lacking the onepass packet.  We used to accept
66 ;; such messages but now consider them invalid.
67 (define bad_ls_asc "
68 -----BEGIN PGP MESSAGE-----
69
70 rQEHYgNtc2dEDFJaSSB0aGluayB0aGF0IGFsbCByaWdodC10aGlua2luZyBwZW9w
71 bGUgaW4gdGhpcyBjb3VudHJ5IGFyZSBzaWNrIGFuZAp0aXJlZCBvZiBiZWluZyB0
72 b2xkIHRoYXQgb3JkaW5hcnkgZGVjZW50IHBlb3BsZSBhcmUgZmVkIHVwIGluIHRo
73 aXMKY291bnRyeSB3aXRoIGJlaW5nIHNpY2sgYW5kIHRpcmVkLiAgSSdtIGNlcnRh
74 aW5seSBub3QuICBCdXQgSSdtCnNpY2sgYW5kIHRpcmVkIG9mIGJlaW5nIHRvbGQg
75 dGhhdCBJIGFtLgotIE1vbnR5IFB5dGhvbgqIPwMFAEQMUlotcnzHaGl3NBECR4IA
76 oJlEGTY+bHjD2HYuCixLQCmk01pbAKCIjkzLOAmkZNm0D8luT78c/1x45Q==
77 =Mpiu
78 -----END PGP MESSAGE-----
79 ")
80
81
82 ;; A signed message prefixed with an unsigned literal packet.
83 ;; (fols = faked-literal-data, one-pass, literal-data, signature)
84 ;; This should throw an error because running gpg to extract the
85 ;; signed data will return both literal data packets
86 (define bad_fols_asc "
87 -----BEGIN PGP MESSAGE-----
88
89 rF1iDG1zZy51bnNpZ25lZEQMY0x0aW1lc2hhcmluZywgbjoKCUFuIGFjY2VzcyBt
90 ZXRob2Qgd2hlcmVieSBvbmUgY29tcHV0ZXIgYWJ1c2VzIG1hbnkgcGVvcGxlLgqQ
91 DQMAAhEtcnzHaGl3NAGtAQdiA21zZ0QMUlpJIHRoaW5rIHRoYXQgYWxsIHJpZ2h0
92 LXRoaW5raW5nIHBlb3BsZSBpbiB0aGlzIGNvdW50cnkgYXJlIHNpY2sgYW5kCnRp
93 cmVkIG9mIGJlaW5nIHRvbGQgdGhhdCBvcmRpbmFyeSBkZWNlbnQgcGVvcGxlIGFy
94 ZSBmZWQgdXAgaW4gdGhpcwpjb3VudHJ5IHdpdGggYmVpbmcgc2ljayBhbmQgdGly
95 ZWQuICBJJ20gY2VydGFpbmx5IG5vdC4gIEJ1dCBJJ20Kc2ljayBhbmQgdGlyZWQg
96 b2YgYmVpbmcgdG9sZCB0aGF0IEkgYW0uCi0gTW9udHkgUHl0aG9uCog/AwUARAxS
97 Wi1yfMdoaXc0EQJHggCgmUQZNj5seMPYdi4KLEtAKaTTWlsAoIiOTMs4CaRk2bQP
98 yW5Pvxz/XHjl
99 =UNM4
100 -----END PGP MESSAGE-----
101 ")
102
103 ;; A signed message suffixed with an unsigned literal packet.
104 ;; (fols = faked-literal-data, one-pass, literal-data, signature)
105 ;; This should throw an error because running gpg to extract the
106 ;; signed data will return both literal data packets
107 (define bad_olsf_asc "
108 -----BEGIN PGP MESSAGE-----
109
110 kA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGluayB0aGF0IGFsbCByaWdo
111 dC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5IGFyZSBzaWNrIGFuZAp0
112 aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkgZGVjZW50IHBlb3BsZSBh
113 cmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJlaW5nIHNpY2sgYW5kIHRp
114 cmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdtCnNpY2sgYW5kIHRpcmVk
115 IG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5IFB5dGhvbgqIPwMFAEQM
116 UlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk01pbAKCIjkzLOAmkZNm0
117 D8luT78c/1x45axdYgxtc2cudW5zaWduZWREDGNMdGltZXNoYXJpbmcsIG46CglB
118 biBhY2Nlc3MgbWV0aG9kIHdoZXJlYnkgb25lIGNvbXB1dGVyIGFidXNlcyBtYW55
119 IHBlb3BsZS4K
120 =3gnG
121 -----END PGP MESSAGE-----
122 ")
123
124
125 ;; Two standard signed messages in a row
126 (define msg_olsols_asc_multiple "
127 -----BEGIN PGP MESSAGE-----
128
129 kA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGluayB0aGF0IGFsbCByaWdo
130 dC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5IGFyZSBzaWNrIGFuZAp0
131 aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkgZGVjZW50IHBlb3BsZSBh
132 cmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJlaW5nIHNpY2sgYW5kIHRp
133 cmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdtCnNpY2sgYW5kIHRpcmVk
134 IG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5IFB5dGhvbgqIPwMFAEQM
135 UlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk01pbAKCIjkzLOAmkZNm0
136 D8luT78c/1x45ZANAwACES1yfMdoaXc0Aa0BB2IDbXNnRAxSWkkgdGhpbmsgdGhh
137 dCBhbGwgcmlnaHQtdGhpbmtpbmcgcGVvcGxlIGluIHRoaXMgY291bnRyeSBhcmUg
138 c2ljayBhbmQKdGlyZWQgb2YgYmVpbmcgdG9sZCB0aGF0IG9yZGluYXJ5IGRlY2Vu
139 dCBwZW9wbGUgYXJlIGZlZCB1cCBpbiB0aGlzCmNvdW50cnkgd2l0aCBiZWluZyBz
140 aWNrIGFuZCB0aXJlZC4gIEknbSBjZXJ0YWlubHkgbm90LiAgQnV0IEknbQpzaWNr
141 IGFuZCB0aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgSSBhbS4KLSBNb250eSBQeXRo
142 b24KiD8DBQBEDFJaLXJ8x2hpdzQRAkeCAKCZRBk2Pmx4w9h2LgosS0AppNNaWwCg
143 iI5MyzgJpGTZtA/Jbk+/HP9ceOU=
144 =8nLN
145 -----END PGP MESSAGE-----
146 ")
147
148 ;; A standard message with two signatures (actually the same signature
149 ;; duplicated).
150 (define msg_oolss_asc "
151 -----BEGIN PGP MESSAGE-----
152
153 kA0DAAIRLXJ8x2hpdzQBkA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGlu
154 ayB0aGF0IGFsbCByaWdodC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5
155 IGFyZSBzaWNrIGFuZAp0aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkg
156 ZGVjZW50IHBlb3BsZSBhcmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJl
157 aW5nIHNpY2sgYW5kIHRpcmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdt
158 CnNpY2sgYW5kIHRpcmVkIG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5
159 IFB5dGhvbgqIPwMFAEQMUlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk
160 01pbAKCIjkzLOAmkZNm0D8luT78c/1x45Yg/AwUARAxSWi1yfMdoaXc0EQJHggCg
161 mUQZNj5seMPYdi4KLEtAKaTTWlsAoIiOTMs4CaRk2bQPyW5Pvxz/XHjl
162 =KVw5
163 -----END PGP MESSAGE-----
164 ")
165
166 ;; A standard message with two one-pass packet but only one signature
167 ;; packet
168 (define bad_ools_asc "
169 -----BEGIN PGP MESSAGE-----
170
171 kA0DAAIRLXJ8x2hpdzQBkA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGlu
172 ayB0aGF0IGFsbCByaWdodC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5
173 IGFyZSBzaWNrIGFuZAp0aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkg
174 ZGVjZW50IHBlb3BsZSBhcmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJl
175 aW5nIHNpY2sgYW5kIHRpcmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdt
176 CnNpY2sgYW5kIHRpcmVkIG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5
177 IFB5dGhvbgqIPwMFAEQMUlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk
178 01pbAKCIjkzLOAmkZNm0D8luT78c/1x45Q==
179 =1/ix
180 -----END PGP MESSAGE-----
181 ")
182
183 ;; Standard cleartext signature
184 (define msg_cls_asc "
185 -----BEGIN PGP SIGNED MESSAGE-----
186 Hash: SHA1
187
188 I think that all right-thinking people in this country are sick and
189 tired of being told that ordinary decent people are fed up in this
190 country with being sick and tired.  I'm certainly not.  But I'm
191 sick and tired of being told that I am.
192 - - Monty Python
193 -----BEGIN PGP SIGNATURE-----
194
195 iD8DBQFEDVp1LXJ8x2hpdzQRAplUAKCMfpG3GPw/TLN52tosgXP5lNECkwCfQhAa
196 emmev7IuQjWYrGF9Lxj+zj8=
197 =qJsY
198 -----END PGP SIGNATURE-----
199 ")
200
201 ;; Cleartext signature with two signatures
202 (define msg_clss_asc "
203 -----BEGIN PGP SIGNED MESSAGE-----
204 Hash: SHA1
205
206 What is the difference between a Turing machine and the modern computer?
207 It's the same as that between Hillary's ascent of Everest and the
208 establishment of a Hilton on its peak.
209 -----BEGIN PGP SIGNATURE-----
210
211 iD8DBQFEDVz6LXJ8x2hpdzQRAtkGAKCeMhNbHnh339fpjNj9owsYcC4zBwCfYO5l
212 2u+KEfXX0FKyk8SMzLjZ536IPwMFAUQNXPr+GAsdqeOwshEC2QYAoPOWAiQm0EF/
213 FWIAQUplk7JWbyRKAJ92ZJyJpWfzb0yc1s7MY65r2qEHrg==
214 =1Xvv
215 -----END PGP SIGNATURE-----
216 ")
217
218 ;; Two clear text signatures in a row
219 (define msg_clsclss_asc_multiple (string-append msg_cls_asc msg_clss_asc))
220
221
222 ;; An Ed25519 cleartext message with an R parameter of only 247 bits
223 ;; so that the code to re-insert the stripped zero byte kicks in.  The
224 ;; S parameter has 253 bits but that does not strip a full byte.
225 ;;
226 ;; Note that the message has a typo ("the the"), but this should not
227 ;; be fixed because it breaks this test.
228 (define msg_ed25519_rshort "
229 -----BEGIN PGP SIGNED MESSAGE-----
230 Hash: SHA256
231
232 Dear Emily:
233         I'm still confused as to what groups articles should be posted
234 to.  How about an example?
235                 -- Still Confused
236
237 Dear Still:
238         Ok.  Let's say you want to report that Gretzky has been traded from
239 the Oilers to the Kings.  Now right away you might think rec.sport.hockey
240 would be enough.  WRONG.  Many more people might be interested.  This is a
241 big trade!  Since it's a NEWS article, it belongs in the news.* hierarchy
242 as well.  If you are a news admin, or there is one on your machine, try
243 news.admin.  If not, use news.misc.
244         The Oilers are probably interested in geology, so try sci.physics.
245 He is a big star, so post to sci.astro, and sci.space because they are also
246 interested in stars.  Next, his name is Polish sounding.  So post to
247 soc.culture.polish.  But that group doesn't exist, so cross-post to
248 news.groups suggesting it should be created.  With this many groups of
249 interest, your article will be quite bizarre, so post to talk.bizarre as
250 well.  (And post to comp.std.mumps, since they hardly get any articles
251 there, and a \"comp\" group will propagate your article further.)
252         You may also find it is more fun to post the article once in each
253 group.  If you list all the newsgroups in the same article, some newsreaders
254 will only show the the article to the reader once!  Don't tolerate this.
255                 -- Emily Postnews Answers Your Questions on Netiquette
256 -----BEGIN PGP SIGNATURE-----
257
258 iJEEARYIADoWIQSyHeq0+HX7PaQvHR0TlWNoKgINCgUCV772DhwccGF0cmljZS5s
259 dW11bWJhQGV4YW1wbGUubmV0AAoJEBOVY2gqAg0KMAIA90EtUwAja0iJGpO91wyz
260 GLh9pS5v495V0r94yU6uUyUA/RT/StyPWe1wbnEZuacZnLbUV6Yy/aTXCVAlxf0r
261 TusO
262 =vQ3f
263 -----END PGP SIGNATURE-----
264 ")
265
266 ;; An Ed25519 cleartext message with an S parameter of only 248 bits
267 ;; so that the code to re-insert the stripped zero byte kicks in.
268 (define msg_ed25519_sshort "
269 -----BEGIN PGP SIGNED MESSAGE-----
270 Hash: SHA256
271
272 All articles that coruscate with resplendence are not truly auriferous.
273 -----BEGIN PGP SIGNATURE-----
274
275 iJEEARYIADoWIQSyHeq0+HX7PaQvHR0TlWNoKgINCgUCV771QhwccGF0cmljZS5s
276 dW11bWJhQGV4YW1wbGUubmV0AAoJEBOVY2gqAg0KHVEBAI66OPDYXKWO3r6SaFT+
277 uxmh8x4ZerW41vMA9gkJ4AEKAPjoe/Z7fDqo1lCptIFutFAGbfNxcm/53prfx2fT
278 GisM
279 =L7sk
280 -----END PGP SIGNATURE-----
281 ")