Debian Codegraph @

openpgp/clearsign/clearsign_test.go

raw
1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package clearsign
6
7 import (
8 "bufio"
9 "bytes"
10 "crypto"
11 "fmt"
12 "io"
13 "strings"
14 "testing"
15
16 "github.com/ProtonMail/go-crypto/openpgp"
17 "github.com/ProtonMail/go-crypto/openpgp/packet"
18 )
19
20 var allowAllAlgorithmsConfig = &packet.Config{
21 RejectPublicKeyAlgorithms: map[packet.PublicKeyAlgorithm]bool{},
22 RejectMessageHashAlgorithms: map[crypto.Hash]bool{},
23 RejectCurves: map[packet.Curve]bool{},
24 MinRSABits: 512,
25 }
26
27 func testParse(t *testing.T, input []byte, expected, expectedPlaintext string) {
28 b, rest := Decode(input)
29 if b == nil {
30 t.Fatal("failed to decode clearsign message")
31 }
32 if !bytes.Equal(rest, []byte("trailing")) {
33 t.Errorf("unexpected remaining bytes returned: %s", string(rest))
34 }
35 if b.ArmoredSignature.Type != "PGP SIGNATURE" {
36 t.Errorf("bad armor type, got:%s, want:PGP SIGNATURE", b.ArmoredSignature.Type)
37 }
38 if !bytes.Equal(b.Bytes, []byte(expected)) {
39 t.Errorf("bad body, got:%x want:%x", b.Bytes, expected)
40 }
41
42 if !bytes.Equal(b.Plaintext, []byte(expectedPlaintext)) {
43 t.Errorf("bad plaintext, got:%x want:%x", b.Plaintext, expectedPlaintext)
44 }
45
46 keyring, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(signingKey))
47 if err != nil {
48 t.Errorf("failed to parse public key: %s", err)
49 }
50
51 if _, _, err := openpgp.VerifyDetachedSignature(keyring, bytes.NewBuffer(b.Bytes), b.ArmoredSignature.Body, allowAllAlgorithmsConfig); err != nil {
52 t.Errorf("failed to check signature: %s", err)
53 }
54
55 b, _ = Decode(input)
56 if _, err := b.VerifySignature(keyring, allowAllAlgorithmsConfig); err != nil {
57 t.Errorf("failed to check signature: %s", err)
58 }
59 }
60
61 func TestParse(t *testing.T) {
62 testParse(t, clearsignInput, "Hello world\r\nline 2", "Hello world\nline 2")
63 testParse(t, clearsignInput2, "\r\n\r\n(This message has a couple of blank lines at the start and end.)\r\n\r\n", "\n\n(This message has a couple of blank lines at the start and end.)\n\n")
64 }
65
66 func TestParseWithNoNewlineAtEnd(t *testing.T) {
67 input := clearsignInput
68 input = input[:len(input)-len("trailing")-1]
69 b, rest := Decode(input)
70 if b == nil {
71 t.Fatal("failed to decode clearsign message")
72 }
73 if len(rest) > 0 {
74 t.Errorf("unexpected remaining bytes returned: %s", string(rest))
75 }
76 }
77
78 var signingTests = []struct {
79 in, signed, plaintext string
80 }{
81 {"", "", ""},
82 {"a", "a", "a"},
83 {"a\n", "a\r\n", "a\n"},
84 {"-a\n", "-a\r\n", "-a\n"},
85 {"--a\nb", "--a\r\nb", "--a\nb"},
86 // leading whitespace
87 {" a\n", " a\r\n", " a\n"},
88 {" a\n", " a\r\n", " a\n"},
89 // trailing whitespace (should be stripped)
90 {"a \n", "a\r\n", "a\n"},
91 {"a ", "a", "a"},
92 {" \n", "\r\n", "\n"},
93 {" ", "", ""},
94 {"a\n \n \nb\n", "a\r\n\r\n\r\nb\r\n", "a\n\n\nb\n"},
95 {"a\n \n \nb\n", "a\r\n\r\n\r\nb\r\n", "a\n\n\nb\n"},
96 }
97
98 func TestVerifyV6(t *testing.T) {
99 keyring, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(clearSignV6PublicKey))
100 if err != nil {
101 t.Errorf("failed to parse public key: %s", err)
102 }
103 b, _ := Decode([]byte(clearSignV6))
104 _, err = b.VerifySignature(keyring, nil)
105 if err != nil {
106 t.Errorf("failed to verify signature: %s", err)
107 }
108 }
109
110 func TestSigning(t *testing.T) {
111 keyring, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(signingKey))
112 if err != nil {
113 t.Errorf("failed to parse public key: %s", err)
114 }
115 for i, test := range signingTests {
116 var buf bytes.Buffer
117
118 plaintext, err := Encode(&buf, keyring[0].PrivateKey, allowAllAlgorithmsConfig)
119 if err != nil {
120 t.Errorf("#%d: error from Encode: %s", i, err)
121 continue
122 }
123 if _, err := plaintext.Write([]byte(test.in)); err != nil {
124 t.Errorf("#%d: error from Write: %s", i, err)
125 continue
126 }
127 if err := plaintext.Close(); err != nil {
128 t.Fatalf("#%d: error from Close: %s", i, err)
129 continue
130 }
131
132 b, _ := Decode(buf.Bytes())
133 if b == nil {
134 t.Errorf("#%d: failed to decode clearsign message", i)
135 continue
136 }
137 if !bytes.Equal(b.Bytes, []byte(test.signed)) {
138 t.Errorf("#%d: bad result, got:%x, want:%x", i, b.Bytes, test.signed)
139 continue
140 }
141 if !bytes.Equal(b.Plaintext, []byte(test.plaintext)) {
142 t.Errorf("#%d: bad result, got:%x, want:%x", i, b.Plaintext, test.plaintext)
143 continue
144 }
145
146 if _, _, err := openpgp.VerifyDetachedSignature(keyring, bytes.NewBuffer(b.Bytes), b.ArmoredSignature.Body, allowAllAlgorithmsConfig); err != nil {
147 t.Errorf("#%d: failed to check signature: %s", i, err)
148 }
149 }
150 }
151
152 func TestSigningInterop(t *testing.T) {
153 keyring, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(signingKey))
154 if err != nil {
155 t.Errorf("failed to parse public key: %s", err)
156 }
157
158 var buf bytes.Buffer
159 plaintext, err := Encode(&buf, keyring[0].PrivateKey, nil)
160 if err != nil {
161 t.Errorf("error from Encode")
162 }
163 if _, err := plaintext.Write([]byte(trickyGrocery)); err != nil {
164 t.Errorf("error from Write")
165 }
166 if err := plaintext.Close(); err != nil {
167 t.Fatalf("error from Close")
168 }
169 expected := "- - tofu\n- - vegetables\n- - noodles\n\n\n"
170 if !strings.Contains(buf.String(), expected) {
171 t.Fatalf("expected output to contain %s but got: %s", expected, buf.String())
172 }
173 }
174
175 func TestHashHeader(t *testing.T) {
176 tests := []struct {
177 name string
178 hashTypes []crypto.Hash
179 expected string
180 }{
181 {
182 name: "unique hashes",
183 hashTypes: []crypto.Hash{
184 crypto.SHA256,
185 crypto.SHA512,
186 crypto.SHA3_512,
187 },
188 expected: "Hash: SHA256,SHA512,SHA3-512\n",
189 },
190 {
191 name: "with duplicates",
192 hashTypes: []crypto.Hash{
193 crypto.SHA256,
194 crypto.SHA512,
195 crypto.SHA512,
196 crypto.SHA3_512,
197 },
198 expected: "Hash: SHA256,SHA512,SHA3-512\n",
199 },
200 {
201 name: "with duplicates",
202 hashTypes: []crypto.Hash{
203 crypto.SHA256,
204 crypto.SHA256,
205 crypto.SHA256,
206 crypto.SHA256,
207 },
208 expected: "Hash: SHA256\n",
209 },
210 }
211
212 for _, tc := range tests {
213 t.Run(tc.name, func(t *testing.T) {
214 var buf bytes.Buffer
215 writer := bufio.NewWriter(&buf)
216 if err := writeHashHeader(writer, tc.hashTypes); err != nil {
217 t.Fatalf("unexpected error: %v", err)
218 }
219
220 if err := writer.Flush(); err != nil {
221 t.Fatalf("flush failed: %v", err)
222 }
223
224 actual := buf.String()
225 if actual != tc.expected {
226 t.Errorf("output mismatch:\nExpected: %q\nActual: %q", tc.expected, actual)
227 }
228 })
229 }
230 }
231
232 func testMultiSign(t *testing.T, v6 bool) {
233 if testing.Short() {
234 t.Skip("skipping long test in -short mode")
235 }
236
237 config := packet.Config{V6Keys: v6}
238
239 for nKeys := 1; nKeys < 4; nKeys++ {
240 nextTest:
241 for nExtra := 2; nExtra < 4; nExtra++ {
242 var signKeys []*packet.PrivateKey
243 var verifyKeys openpgp.EntityList
244
245 desc := fmt.Sprintf("%d keys; %d of which will be used to verify", nKeys+nExtra, nKeys)
246 for i := 0; i < nKeys+nExtra; i++ {
247 e, err := openpgp.NewEntity("name", "comment", "email", &config)
248 if err != nil {
249 t.Errorf("cannot create key: %v", err)
250 continue nextTest
251 }
252 if i < nKeys {
253 verifyKeys = append(verifyKeys, e)
254 }
255 signKeys = append(signKeys, e.PrivateKey)
256 }
257
258 input := []byte("this is random text\r\n4 17")
259 var output bytes.Buffer
260 w, err := EncodeMultiWithHeader(&output, signKeys, nil, nil)
261 if err != nil {
262 t.Errorf("EncodeMulti (%s) failed: %v", desc, err)
263 }
264 if _, err := w.Write(input); err != nil {
265 t.Errorf("Write(%q) to signer (%s) failed: %v", string(input), desc, err)
266 }
267 if err := w.Close(); err != nil {
268 t.Errorf("Close() of signer (%s) failed: %v", desc, err)
269 }
270
271 block, _ := Decode(output.Bytes())
272 if string(block.Bytes) != string(input) {
273 t.Errorf("Inline data didn't match original; got %q want %q", string(block.Bytes), string(input))
274 }
275 config := &packet.Config{}
276 _, _, err = openpgp.VerifyDetachedSignature(verifyKeys, bytes.NewReader(block.Bytes), block.ArmoredSignature.Body, config)
277 if nKeys == 0 {
278 if err == nil {
279 t.Errorf("verifying inline (%s) succeeded; want failure", desc)
280 }
281 } else {
282 if err != nil {
283 t.Errorf("verifying inline (%s) failed (%v); want success", desc, err)
284 }
285 }
286 }
287 }
288 }
289
290 func TestMultiSignV4(t *testing.T) {
291 testMultiSign(t, false)
292 }
293
294 func TestMultiSignV6(t *testing.T) {
295 testMultiSign(t, true)
296 }
297
298 func TestDecodeMissingCRC(t *testing.T) {
299 block, rest := Decode(clearsignInput3)
300 if block == nil {
301 t.Fatal("failed to decode PGP signature missing a CRC")
302 }
303 if len(rest) > 0 {
304 t.Fatalf("Decode should not have any remaining data left: %s", rest)
305 }
306 if _, err := packet.Read(block.ArmoredSignature.Body); err != nil {
307 t.Error(err)
308 }
309 if _, err := packet.Read(block.ArmoredSignature.Body); err != io.EOF {
310 t.Error(err)
311 }
312 }
313
314 const signatureBlock = `
315 -----BEGIN PGP SIGNATURE-----
316 Version: OpenPrivacy 0.99
317
318 yDgBO22WxBHv7O8X7O/jygAEzol56iUKiXmV+XmpCtmpqQUKiQrFqclFqUDBovzS
319 vBSFjNSiVHsuAA==
320 =njUN
321 -----END PGP SIGNATURE-----
322 `
323
324 var invalidInputs = []string{
325 `
326 -----BEGIN PGP SIGNED MESSAGE-----
327 Hash: SHA256
328
329 (This message was truncated.)
330 `,
331 `
332 -----BEGIN PGP SIGNED MESSAGE-----garbage
333 Hash: SHA256
334
335 _o/
336 ` + signatureBlock,
337 `
338 garbage-----BEGIN PGP SIGNED MESSAGE-----
339 Hash: SHA256
340
341 _o/
342 ` + signatureBlock,
343 `
344 -----BEGIN PGP SIGNED MESSAGE-----
345 Hash: SHA` + "\x0b\x0b" + `256
346
347 _o/
348 ` + signatureBlock,
349 `
350 -----BEGIN PGP SIGNED MESSAGE-----
351 NotHash: SHA256
352
353 _o/
354 ` + signatureBlock,
355 `
356 -----BEGIN PGP SIGNED MESSAGE-----
357 Hash: SHA256 Hello world this should not be allowed
358
359 _o/
360 ` + signatureBlock,
361 }
362
363 func TestParseInvalid(t *testing.T) {
364 for i, input := range invalidInputs {
365 if b, rest := Decode([]byte(input)); b != nil {
366 t.Errorf("#%d: decoded a bad clearsigned message without any error", i)
367 } else if string(rest) != input {
368 t.Errorf("#%d: did not return all data with a bad message", i)
369 }
370 }
371 }
372
373 var clearsignInput = []byte(`
374 ;lasjlkfdsa
375
376 -----BEGIN PGP SIGNED MESSAGE-----
377 Hash: SHA1
378
379 Hello world
380 line 2
381 -----BEGIN PGP SIGNATURE-----
382 Version: GnuPG v1.4.10 (GNU/Linux)
383
384 iJwEAQECAAYFAk8kMuEACgkQO9o98PRieSpMsAQAhmY/vwmNpflrPgmfWsYhk5O8
385 pjnBUzZwqTDoDeINjZEoPDSpQAHGhjFjgaDx/Gj4fAl0dM4D0wuUEBb6QOrwflog
386 2A2k9kfSOMOtk0IH/H5VuFN1Mie9L/erYXjTQIptv9t9J7NoRBMU0QOOaFU0JaO9
387 MyTpno24AjIAGb+mH1U=
388 =hIJ6
389 -----END PGP SIGNATURE-----
390 trailing`)
391
392 var clearsignInput2 = []byte(`
393 asdlfkjasdlkfjsadf
394
395 -----BEGIN PGP SIGNED MESSAGE-----
396 Hash: SHA256
397
398
399
400 (This message has a couple of blank lines at the start and end.)
401
402
403 -----BEGIN PGP SIGNATURE-----
404 Version: GnuPG v1.4.11 (GNU/Linux)
405
406 iJwEAQEIAAYFAlPpSREACgkQO9o98PRieSpZTAP+M8QUoCt/7Rf3YbXPcdzIL32v
407 pt1I+cMNeopzfLy0u4ioEFi8s5VkwpL1AFmirvgViCwlf82inoRxzZRiW05JQ5LI
408 ESEzeCoy2LIdRCQ2hcrG8pIUPzUO4TqO5D/dMbdHwNH4h5nNmGJUAEG6FpURlPm+
409 qZg6BaTvOxepqOxnhVU=
410 =e+C6
411 -----END PGP SIGNATURE-----
412
413 trailing`)
414
415 var clearsignInput3 = []byte(`-----BEGIN PGP SIGNED MESSAGE-----
416 Hash: SHA256
417
418 Origin: vscode stable
419 Label: vscode stable
420 Suite: stable
421 Codename: stable
422 Date: Mon, 13 Jan 2020 08:41:45 UTC
423 Architectures: amd64
424 Components: main
425 Description: Generated by aptly
426 MD5Sum:
427 66437152b3082616d8053e52c4bafafb 5821166 Contents-amd64
428 8024662ed51109946a517754bbafdd33 286298 Contents-amd64.gz
429 66437152b3082616d8053e52c4bafafb 5821166 main/Contents-amd64
430 8024662ed51109946a517754bbafdd33 286298 main/Contents-amd64.gz
431 3062a08b3eca94a65d6d17ba1dafcf3e 1088265 main/binary-amd64/Packages
432 b8ee22200fba8fa3be56c1ff946cdd24 159344 main/binary-amd64/Packages.bz2
433 f89c47c81ebd25caf287c8e6dda16c1a 169456 main/binary-amd64/Packages.gz
434 4c9ca25b556f111a5536c78df885ad82 95 main/binary-amd64/Release
435 SHA1:
436 2b62d0e322746b7d094878278f49993ca4314bf7 5821166 Contents-amd64
437 aafe35cce12e03d8b1939e403ddf5c0958c6e9bd 286298 Contents-amd64.gz
438 2b62d0e322746b7d094878278f49993ca4314bf7 5821166 main/Contents-amd64
439 aafe35cce12e03d8b1939e403ddf5c0958c6e9bd 286298 main/Contents-amd64.gz
440 30316ac5d4ce3b472a96a797eeb0a2a82d43ed3e 1088265 main/binary-amd64/Packages
441 6507e0b4da8194fd1048fcbb74c6e7433edaf3d6 159344 main/binary-amd64/Packages.bz2
442 ec9d39c39567c74001221e4900fb5d11ec11b833 169456 main/binary-amd64/Packages.gz
443 58bf20987a91d35936f18efce75ea233d43dbf8b 95 main/binary-amd64/Release
444 SHA256:
445 deff9ebfc44bf482e10a6ea10f608c6bb0fdc8373bf86b88cad9d99879ae3c39 5821166 Contents-amd64
446 f163bc65c7666ef58e0be3336e8c846ae2b7b388fbb2d7db0bcdc3fd1abae462 286298 Contents-amd64.gz
447 deff9ebfc44bf482e10a6ea10f608c6bb0fdc8373bf86b88cad9d99879ae3c39 5821166 main/Contents-amd64
448 f163bc65c7666ef58e0be3336e8c846ae2b7b388fbb2d7db0bcdc3fd1abae462 286298 main/Contents-amd64.gz
449 0fba50799ef72d0c2b354d0bcbbc8c623f6dae5a7fd7c218a54ea44dd8a49d5e 1088265 main/binary-amd64/Packages
450 69382470a88b67acde80fe45ab223016adebc445713ff0aa3272902581d21f13 159344 main/binary-amd64/Packages.bz2
451 1724b8ace5bd8882943e9463d8525006f33ca704480da0186fd47937451dc216 169456 main/binary-amd64/Packages.gz
452 0f509a0cb07e0ab433176fa47a21dccccc6b519f25f640cc58561104c11de6c2 95 main/binary-amd64/Release
453 SHA512:
454 f69f09c6180ceb6625a84b5f7123ad27972983146979dcfd9c38b2990459b52b4975716f85374511486bb5ad5852ebb1ef8265176df7134fc15b17ada3ba596c 5821166 Contents-amd64
455 46031bf89166188989368957d20cdcaac6eec72bab3f9839c9704bb08cbee3174ca6da11e290b0eab0e6b5754c1e7feb06d18ec9c5a0c955029cef53235e0a3a 286298 Contents-amd64.gz
456 f69f09c6180ceb6625a84b5f7123ad27972983146979dcfd9c38b2990459b52b4975716f85374511486bb5ad5852ebb1ef8265176df7134fc15b17ada3ba596c 5821166 main/Contents-amd64
457 46031bf89166188989368957d20cdcaac6eec72bab3f9839c9704bb08cbee3174ca6da11e290b0eab0e6b5754c1e7feb06d18ec9c5a0c955029cef53235e0a3a 286298 main/Contents-amd64.gz
458 3f78baf5adbaf0100996555b154807c794622fd0b5879b568ae0b6560e988fbfabed8d97db5a703d1a58514b9690fc6b60f9ad2eeece473d86ab257becd0ae41 1088265 main/binary-amd64/Packages
459 18f26df90beff29192662ca40525367c3c04f4581d59d2e9ab1cd0700a145b6a292a1609ca33ebe1c211f13718a8eee751f41fd8189cf93d52aa3e0851542dfc 159344 main/binary-amd64/Packages.bz2
460 6a6d917229e0cf06c493e174a87d76e815717676f2c70bcbd3bc689a80bd3c5489ea97db83b8f74cba8e70f374f9d9974f22b1ed2687a4ba1dacd22fdef7e14d 169456 main/binary-amd64/Packages.gz
461 e1a4378ad266c13c2edf8a0e590fa4d11973ab99ce79f15af005cb838f1600f66f3dc6da8976fa8b474da9073c118039c27623ab3360c6df115071497fe4f50c 95 main/binary-amd64/Release
462
463 -----BEGIN PGP SIGNATURE-----
464 Version: BSN Pgp v1.0.0.0
465
466 iQEcBAEBCAAGBQJeHC1bAAoJEOs+lK2+EinPAg8H/1rrhcgfm1HYL+Vmr9Ns6ton
467 LWQ8r13ADN66UTRa3XsO9V+q1fYowTqpXq6EZt2Gmlby/cpDf7mFPM5IteOXWLl7
468 QcWxPKHcdPIUi+h5F7BkFW65imP9GyX+V5Pxx5X544op7hYKaI0gAQ1oYtWDb3HE
469 4D27fju6icbj8w6E8TePcrDn82UvWAcaI5WSLboyhXCt2DxS3PNGFlyaP58zKJ8F
470 9cbBzksuMgMaTPAAMrU0zrFGfGeQz0Yo6nV/gRGiQaL9pSeIJWSKLNCMG/nIGmv2
471 xHVNFqTEetREY6UcQmuhwOn4HezyigH6XCBVp/Uez1izXiNdwBOet34SSvnkuJ4=
472 -----END PGP SIGNATURE-----`)
473
474 var signingKey = `-----BEGIN PGP PRIVATE KEY BLOCK-----
475 Version: GnuPG v1.4.10 (GNU/Linux)
476
477 lQHYBE2rFNoBBADFwqWQIW/DSqcB4yCQqnAFTJ27qS5AnB46ccAdw3u4Greeu3Bp
478 idpoHdjULy7zSKlwR1EA873dO/k/e11Ml3dlAFUinWeejWaK2ugFP6JjiieSsrKn
479 vWNicdCS4HTWn0X4sjl0ZiAygw6GNhqEQ3cpLeL0g8E9hnYzJKQ0LWJa0QARAQAB
480 AAP/TB81EIo2VYNmTq0pK1ZXwUpxCrvAAIG3hwKjEzHcbQznsjNvPUihZ+NZQ6+X
481 0HCfPAdPkGDCLCb6NavcSW+iNnLTrdDnSI6+3BbIONqWWdRDYJhqZCkqmG6zqSfL
482 IdkJgCw94taUg5BWP/AAeQrhzjChvpMQTVKQL5mnuZbUCeMCAN5qrYMP2S9iKdnk
483 VANIFj7656ARKt/nf4CBzxcpHTyB8+d2CtPDKCmlJP6vL8t58Jmih+kHJMvC0dzn
484 gr5f5+sCAOOe5gt9e0am7AvQWhdbHVfJU0TQJx+m2OiCJAqGTB1nvtBLHdJnfdC9
485 TnXXQ6ZXibqLyBies/xeY2sCKL5qtTMCAKnX9+9d/5yQxRyrQUHt1NYhaXZnJbHx
486 q4ytu0eWz+5i68IYUSK69jJ1NWPM0T6SkqpB3KCAIv68VFm9PxqG1KmhSrQIVGVz
487 dCBLZXmIuAQTAQIAIgUCTasU2gIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AA
488 CgkQO9o98PRieSoLhgQAkLEZex02Qt7vGhZzMwuN0R22w3VwyYyjBx+fM3JFETy1
489 ut4xcLJoJfIaF5ZS38UplgakHG0FQ+b49i8dMij0aZmDqGxrew1m4kBfjXw9B/v+
490 eIqpODryb6cOSwyQFH0lQkXC040pjq9YqDsO5w0WYNXYKDnzRV0p4H1pweo2VDid
491 AdgETasU2gEEAN46UPeWRqKHvA99arOxee38fBt2CI08iiWyI8T3J6ivtFGixSqV
492 bRcPxYO/qLpVe5l84Nb3X71GfVXlc9hyv7CD6tcowL59hg1E/DC5ydI8K8iEpUmK
493 /UnHdIY5h8/kqgGxkY/T/hgp5fRQgW1ZoZxLajVlMRZ8W4tFtT0DeA+JABEBAAEA
494 A/0bE1jaaZKj6ndqcw86jd+QtD1SF+Cf21CWRNeLKnUds4FRRvclzTyUMuWPkUeX
495 TaNNsUOFqBsf6QQ2oHUBBK4VCHffHCW4ZEX2cd6umz7mpHW6XzN4DECEzOVksXtc
496 lUC1j4UB91DC/RNQqwX1IV2QLSwssVotPMPqhOi0ZLNY7wIA3n7DWKInxYZZ4K+6
497 rQ+POsz6brEoRHwr8x6XlHenq1Oki855pSa1yXIARoTrSJkBtn5oI+f8AzrnN0BN
498 oyeQAwIA/7E++3HDi5aweWrViiul9cd3rcsS0dEnksPhvS0ozCJiHsq/6GFmy7J8
499 QSHZPteedBnZyNp5jR+H7cIfVN3KgwH/Skq4PsuPhDq5TKK6i8Pc1WW8MA6DXTdU
500 nLkX7RGmMwjC0DBf7KWAlPjFaONAX3a8ndnz//fy1q7u2l9AZwrj1qa1iJ8EGAEC
501 AAkFAk2rFNoCGwwACgkQO9o98PRieSo2/QP/WTzr4ioINVsvN1akKuekmEMI3LAp
502 BfHwatufxxP1U+3Si/6YIk7kuPB9Hs+pRqCXzbvPRrI8NHZBmc8qIGthishdCYad
503 AHcVnXjtxrULkQFGbGvhKURLvS9WnzD/m1K2zzwxzkPTzT9/Yf06O6Mal5AdugPL
504 VrM0m72/jnpKo04=
505 =zNCn
506 -----END PGP PRIVATE KEY BLOCK-----
507 `
508
509 // https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-08.html#name-sample-v6-certificate-trans
510 const clearSignV6PublicKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
511
512 xioGY4d/4xsAAAAg+U2nu0jWCmHlZ3BqZYfQMxmZu52JGggkLq2EVD34laPCsQYf
513 GwoAAABCBYJjh3/jAwsJBwUVCg4IDAIWAAKbAwIeCSIhBssYbE8GCaaX5NUt+mxy
514 KwwfHifBilZwj2Ul7Ce62azJBScJAgcCAAAAAK0oIBA+LX0ifsDm185Ecds2v8lw
515 gyU2kCcUmKfvBXbAf6rhRYWzuQOwEn7E/aLwIwRaLsdry0+VcallHhSu4RN6HWaE
516 QsiPlR4zxP/TP7mhfVEe7XWPxtnMUMtf15OyA51YBM4qBmOHf+MZAAAAIIaTJINn
517 +eUBXbki+PSAld2nhJh/LVmFsS+60WyvXkQ1wpsGGBsKAAAALAWCY4d/4wKbDCIh
518 BssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce62azJAAAAAAQBIKbpGG2dWTX8
519 j+VjFM21J0hqWlEg+bdiojWnKfA5AQpWUWtnNwDEM0g12vYxoWM8Y81W+bHBw805
520 I8kWVkXU6vFOi+HWvv/ira7ofJu16NnoUkhclkUrk0mXubZvyl4GBg==
521 -----END PGP PUBLIC KEY BLOCK-----`
522
523 // https://gitlab.com/openpgp-wg/rfc4880bis/-/merge_requests/275
524 const clearSignV6 = `-----BEGIN PGP SIGNED MESSAGE-----
525
526 What we need from the grocery store:
527
528 - - tofu
529 - - vegetables
530 - - noodles
531
532 -----BEGIN PGP SIGNATURE-----
533
534 wpgGARsKAAAAKQWCY5ijYyIhBssYbE8GCaaX5NUt+mxyKwwfHifBilZwj2Ul7Ce6
535 2azJAAAAAGk2IHZJX1AhiJD39eLuPBgiUU9wUA9VHYblySHkBONKU/usJ9BvuAqo
536 /FvLFuGWMbKAdA+epq7V4HOtAPlBWmU8QOd6aud+aSunHQaaEJ+iTFjP2OMW0KBr
537 NK2ay45cX1IVAQ==
538 -----END PGP SIGNATURE-----`
539
540 const trickyGrocery = `From the grocery store we need:
541
542 - tofu
543 - vegetables
544 - noodles
545
546 `