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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
|
# gemato: OpenPGP signature support tests
# vim:fileencoding=utf-8
# (c) 2017-2018 Michał Górny
# Licensed under the terms of 2-clause BSD license
import base64
import datetime
import io
import os.path
import shutil
import tempfile
import unittest
import gemato.cli
import gemato.compression
import gemato.manifest
import gemato.openpgp
import gemato.recursiveloader
PUBLIC_KEY = b'''
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFnwXJMBCACgaTVz+d10TGL9zR920sb0GBFsitAJ5ZFzO4E0cg3SHhwI+reM
JQ6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TAQoAMBYhBIHhLBa9jc1gvhgIRRNogOcqexOEBQJZ8FyTAhsDBQsJCg0E
AxUKCAIeAQIXgAAKCRATaIDnKnsThCnkB/0fhTH230idhlfZhFbVgTLxrj4rpsGg
20K8HkMaWzshsONdKkqYaYuRcm2UQZ0Kg5rm9jQsGYuAnzH/7XwmOleY95ycVfBk
je9aXF6BEoGick6C/AK5w77vd1kcBtJDrT4I7vwD4wRkyUdCkpVMVT4z4aZ7lHJ4
ECrrrI/mg0b+sGRyHfXPvIPp7F2959L/dpbhBZDfMOFC0A9LBQBJldKFbQLg3xzX
4tniz/BBrp7KjTOMKU0sufsedI50xc6cvCYCwJElqo86vv69klZHahE/k9nJaUAM
jCvJNJ7pU8YnJSRTQDH0PZEupAdzDU/AhGSrBz5+Jr7N0pQIxq4duE/Q
=r7JK
-----END PGP PUBLIC KEY BLOCK-----
'''
SIGNED_MANIFEST = u'''
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
TIMESTAMP 2017-10-22T18:06:41Z
MANIFEST eclass/Manifest 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
IGNORE local
DATA myebuild-0.ebuild 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
MISC metadata.xml 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
DIST mydistfile.tar.gz 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEEgeEsFr2NzWC+GAhFE2iA5yp7E4QFAloCx+YACgkQE2iA5yp7
E4TYrwf+JxjkVDNtvSN3HjQmdtcayLsaliw/2kqjoaQKs0lZD8+NRe7xPmwSm4bP
XKfoouJ0+/s87vuYJpBBCjtUDA9C9yZIeRTo8+eW6XsZbRRUmUD5ylTS+FpSsUrS
bEyYk4yZQMYrat+GQ1QBv+625nqnSDv5LZHBBZ/rG36GGlwHPbIKIishnDfdG2QQ
zuxkqepNq4Inzp//ES7Bv4qbTzyBI//HzfY31vOgdhhs5N5Ytez3Xxv/KNOTYdi1
ZIfqeaQ4NoefmxQunyEjT+8X2DMaEeHQni7dwjQc+FiN4ReV9aWbLo2O2cArqEHR
mkkhTd2Auao4D2K74BePBuiZ9+eDQA==
=khff
-----END PGP SIGNATURE-----
'''
DASH_ESCAPED_SIGNED_MANIFEST = u'''
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
- TIMESTAMP 2017-10-22T18:06:41Z
- MANIFEST eclass/Manifest 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
IGNORE local
- DATA myebuild-0.ebuild 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
MISC metadata.xml 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
- DIST mydistfile.tar.gz 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEEgeEsFr2NzWC+GAhFE2iA5yp7E4QFAloCx+YACgkQE2iA5yp7
E4TYrwf+JxjkVDNtvSN3HjQmdtcayLsaliw/2kqjoaQKs0lZD8+NRe7xPmwSm4bP
XKfoouJ0+/s87vuYJpBBCjtUDA9C9yZIeRTo8+eW6XsZbRRUmUD5ylTS+FpSsUrS
bEyYk4yZQMYrat+GQ1QBv+625nqnSDv5LZHBBZ/rG36GGlwHPbIKIishnDfdG2QQ
zuxkqepNq4Inzp//ES7Bv4qbTzyBI//HzfY31vOgdhhs5N5Ytez3Xxv/KNOTYdi1
ZIfqeaQ4NoefmxQunyEjT+8X2DMaEeHQni7dwjQc+FiN4ReV9aWbLo2O2cArqEHR
mkkhTd2Auao4D2K74BePBuiZ9+eDQA==
=khff
-----END PGP SIGNATURE-----
'''
MODIFIED_SIGNED_MANIFEST = u'''
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
TIMESTAMP 2017-10-22T18:06:41Z
MANIFEST eclass/Manifest 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
IGNORE local
DATA myebuild-0.ebuild 32
MISC metadata.xml 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
DIST mydistfile.tar.gz 0 MD5 d41d8cd98f00b204e9800998ecf8427e SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEEgeEsFr2NzWC+GAhFE2iA5yp7E4QFAloCx+YACgkQE2iA5yp7
E4TYrwf+JxjkVDNtvSN3HjQmdtcayLsaliw/2kqjoaQKs0lZD8+NRe7xPmwSm4bP
XKfoouJ0+/s87vuYJpBBCjtUDA9C9yZIeRTo8+eW6XsZbRRUmUD5ylTS+FpSsUrS
bEyYk4yZQMYrat+GQ1QBv+625nqnSDv5LZHBBZ/rG36GGlwHPbIKIishnDfdG2QQ
zuxkqepNq4Inzp//ES7Bv4qbTzyBI//HzfY31vOgdhhs5N5Ytez3Xxv/KNOTYdi1
ZIfqeaQ4NoefmxQunyEjT+8X2DMaEeHQni7dwjQc+FiN4ReV9aWbLo2O2cArqEHR
mkkhTd2Auao4D2K74BePBuiZ9+eDQA==
=khff
-----END PGP SIGNATURE-----
'''
KEY_FINGERPRINT = '81E12C16BD8DCD60BE180845136880E72A7B1384'
SIG_TIMESTAMP = datetime.datetime(2017, 11, 8, 10, 1, 26)
def strip_openpgp(text):
lines = text.lstrip().splitlines()
start = lines.index('')
stop = lines.index('-----BEGIN PGP SIGNATURE-----')
return '\n'.join(lines[start+1:stop-start+2]) + '\n'
class SignedManifestTest(unittest.TestCase):
"""
Test whether signed Manifest is read correctly.
"""
def test_manifest_load(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(SIGNED_MANIFEST) as f:
m.load(f, verify_openpgp=False)
self.assertIsNotNone(m.find_timestamp())
self.assertIsNotNone(m.find_path_entry('myebuild-0.ebuild'))
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
def test_dash_escaped_manifest_load(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(DASH_ESCAPED_SIGNED_MANIFEST) as f:
m.load(f, verify_openpgp=False)
self.assertIsNotNone(m.find_timestamp())
self.assertIsNotNone(m.find_path_entry('myebuild-0.ebuild'))
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
def test_modified_manifest_load(self):
"""
Modified Manifest should load correctly since we do not enforce
implicit verification.
"""
m = gemato.manifest.ManifestFile()
with io.StringIO(MODIFIED_SIGNED_MANIFEST) as f:
m.load(f, verify_openpgp=False)
self.assertIsNotNone(m.find_timestamp())
self.assertIsNotNone(m.find_path_entry('myebuild-0.ebuild'))
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
def test_junk_before_manifest_load(self):
m = gemato.manifest.ManifestFile()
with io.StringIO('IGNORE test\n' + SIGNED_MANIFEST) as f:
self.assertRaises(gemato.exceptions.ManifestUnsignedData,
m.load, f, verify_openpgp=False)
def test_junk_after_manifest_load(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(SIGNED_MANIFEST + 'IGNORE test\n') as f:
self.assertRaises(gemato.exceptions.ManifestUnsignedData,
m.load, f, verify_openpgp=False)
def test_signed_manifest_terminated_before_data(self):
m = gemato.manifest.ManifestFile()
with io.StringIO('\n'.join(SIGNED_MANIFEST.splitlines()[:3])) as f:
self.assertRaises(gemato.exceptions.ManifestSyntaxError,
m.load, f, verify_openpgp=False)
def test_signed_manifest_terminated_before_signature(self):
m = gemato.manifest.ManifestFile()
with io.StringIO('\n'.join(SIGNED_MANIFEST.splitlines()[:7])) as f:
self.assertRaises(gemato.exceptions.ManifestSyntaxError,
m.load, f, verify_openpgp=False)
def test_signed_manifest_terminated_before_end(self):
m = gemato.manifest.ManifestFile()
with io.StringIO('\n'.join(SIGNED_MANIFEST.splitlines()[:15])) as f:
self.assertRaises(gemato.exceptions.ManifestSyntaxError,
m.load, f, verify_openpgp=False)
def test_recursive_manifest_loader(self):
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(MODIFIED_SIGNED_MANIFEST)
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(d, 'Manifest'),
verify_openpgp=False)
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
finally:
shutil.rmtree(d)
def test_cli(self):
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(MODIFIED_SIGNED_MANIFEST)
os.mkdir(os.path.join(d, 'eclass'))
with io.open(os.path.join(d, 'eclass/Manifest'), 'w'):
pass
with io.open(os.path.join(d, 'myebuild-0.ebuild'), 'wb') as f:
f.write(b'12345678901234567890123456789012')
with io.open(os.path.join(d, 'metadata.xml'), 'w'):
pass
self.assertEqual(
gemato.cli.main(['gemato', 'verify',
'--no-openpgp-verify', d]),
0)
finally:
shutil.rmtree(d)
def test_recursive_manifest_loader_save_manifest(self):
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(MODIFIED_SIGNED_MANIFEST)
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(d, 'Manifest'),
verify_openpgp=False)
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
m.save_manifest('Manifest')
with io.open(os.path.join(d, 'Manifest'), 'r') as f:
self.assertEqual(f.read(),
strip_openpgp(MODIFIED_SIGNED_MANIFEST))
finally:
shutil.rmtree(d)
class OpenPGPCorrectKeyTest(unittest.TestCase):
"""
Tests performed with correct OpenPGP key set.
"""
def setUp(self):
self.env = gemato.openpgp.OpenPGPEnvironment()
try:
self.env.import_key(io.BytesIO(PUBLIC_KEY))
except gemato.exceptions.OpenPGPNoImplementation as e:
self.env.close()
raise unittest.SkipTest(str(e))
except RuntimeError:
self.env.close()
raise unittest.SkipTest('Unable to import OpenPGP key')
def tearDown(self):
self.env.close()
def test_verify_manifest(self):
with io.StringIO(SIGNED_MANIFEST) as f:
sig = self.env.verify_file(f)
self.assertEqual(sig.fingerprint, KEY_FINGERPRINT)
self.assertEqual(sig.timestamp, SIG_TIMESTAMP)
self.assertIsNone(sig.expire_timestamp)
self.assertEqual(sig.primary_key_fingerprint, KEY_FINGERPRINT)
def test_verify_dash_escaped_manifest(self):
with io.StringIO(DASH_ESCAPED_SIGNED_MANIFEST) as f:
sig = self.env.verify_file(f)
self.assertEqual(sig.fingerprint, KEY_FINGERPRINT)
self.assertEqual(sig.timestamp, SIG_TIMESTAMP)
self.assertIsNone(sig.expire_timestamp)
self.assertEqual(sig.primary_key_fingerprint, KEY_FINGERPRINT)
def test_verify_modified_manifest(self):
with io.StringIO(MODIFIED_SIGNED_MANIFEST) as f:
self.assertRaises(gemato.exceptions.OpenPGPVerificationFailure,
self.env.verify_file, f)
def test_manifest_load(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(SIGNED_MANIFEST) as f:
m.load(f, openpgp_env=self.env)
self.assertIsNotNone(m.find_timestamp())
self.assertIsNotNone(m.find_path_entry('myebuild-0.ebuild'))
self.assertTrue(m.openpgp_signed)
self.assertEqual(m.openpgp_signature.fingerprint, KEY_FINGERPRINT)
self.assertEqual(m.openpgp_signature.timestamp, SIG_TIMESTAMP)
self.assertIsNone(m.openpgp_signature.expire_timestamp)
self.assertEqual(m.openpgp_signature.primary_key_fingerprint, KEY_FINGERPRINT)
def test_dash_escaped_manifest_load(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(DASH_ESCAPED_SIGNED_MANIFEST) as f:
m.load(f, openpgp_env=self.env)
self.assertIsNotNone(m.find_timestamp())
self.assertIsNotNone(m.find_path_entry('myebuild-0.ebuild'))
self.assertTrue(m.openpgp_signed)
self.assertEqual(m.openpgp_signature.fingerprint, KEY_FINGERPRINT)
self.assertEqual(m.openpgp_signature.timestamp, SIG_TIMESTAMP)
self.assertIsNone(m.openpgp_signature.expire_timestamp)
self.assertEqual(m.openpgp_signature.primary_key_fingerprint, KEY_FINGERPRINT)
def test_modified_manifest_load(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(MODIFIED_SIGNED_MANIFEST) as f:
self.assertRaises(gemato.exceptions.OpenPGPVerificationFailure,
m.load, f, openpgp_env=self.env)
def test_recursive_manifest_loader(self):
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(SIGNED_MANIFEST)
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(d, 'Manifest'),
verify_openpgp=True,
openpgp_env=self.env)
self.assertTrue(m.openpgp_signed)
self.assertEqual(m.openpgp_signature.fingerprint, KEY_FINGERPRINT)
self.assertEqual(m.openpgp_signature.timestamp, SIG_TIMESTAMP)
self.assertIsNone(m.openpgp_signature.expire_timestamp)
self.assertEqual(m.openpgp_signature.primary_key_fingerprint, KEY_FINGERPRINT)
finally:
shutil.rmtree(d)
def test_recursive_manifest_loader_compressed(self):
d = tempfile.mkdtemp()
try:
with gemato.compression.open_potentially_compressed_path(
os.path.join(d, 'Manifest.gz'), 'w') as cf:
cf.write(SIGNED_MANIFEST)
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(d, 'Manifest.gz'),
verify_openpgp=True,
openpgp_env=self.env)
self.assertTrue(m.openpgp_signed)
self.assertEqual(m.openpgp_signature.fingerprint, KEY_FINGERPRINT)
self.assertEqual(m.openpgp_signature.timestamp, SIG_TIMESTAMP)
self.assertIsNone(m.openpgp_signature.expire_timestamp)
self.assertEqual(m.openpgp_signature.primary_key_fingerprint, KEY_FINGERPRINT)
finally:
shutil.rmtree(d)
def test_cli(self):
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, '.key.asc'), 'wb') as f:
f.write(PUBLIC_KEY)
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(SIGNED_MANIFEST)
os.mkdir(os.path.join(d, 'eclass'))
with io.open(os.path.join(d, 'eclass/Manifest'), 'w'):
pass
with io.open(os.path.join(d, 'myebuild-0.ebuild'), 'w'):
pass
with io.open(os.path.join(d, 'metadata.xml'), 'w'):
pass
self.assertEqual(
gemato.cli.main(['gemato', 'verify',
'--openpgp-key', os.path.join(d, '.key.asc'),
'--no-refresh-keys',
'--require-signed-manifest', d]),
0)
finally:
shutil.rmtree(d)
class OpenPGPNoKeyTest(unittest.TestCase):
"""
Tests performed without correct OpenPGP key set.
"""
expected_exception = gemato.exceptions.OpenPGPVerificationFailure
def setUp(self):
self.env = gemato.openpgp.OpenPGPEnvironment()
def tearDown(self):
self.env.close()
def test_verify_manifest(self):
with io.StringIO(SIGNED_MANIFEST) as f:
try:
self.assertRaises(self.expected_exception,
self.env.verify_file, f)
except gemato.exceptions.OpenPGPNoImplementation as e:
raise unittest.SkipTest(str(e))
def test_manifest_load(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(SIGNED_MANIFEST) as f:
try:
self.assertRaises(self.expected_exception,
m.load, f, openpgp_env=self.env)
except gemato.exceptions.OpenPGPNoImplementation as e:
raise unittest.SkipTest(str(e))
def test_manifest_load_exception_caught(self):
"""
Test that the Manifest is loaded even if exception is raised.
"""
m = gemato.manifest.ManifestFile()
with io.StringIO(SIGNED_MANIFEST) as f:
try:
m.load(f, openpgp_env=self.env)
except self.expected_exception:
pass
except gemato.exceptions.OpenPGPNoImplementation:
pass
self.assertIsNotNone(m.find_timestamp())
self.assertIsNotNone(m.find_path_entry('myebuild-0.ebuild'))
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
def test_recursive_manifest_loader(self):
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(SIGNED_MANIFEST)
try:
self.assertRaises(self.expected_exception,
gemato.recursiveloader.ManifestRecursiveLoader,
os.path.join(d, 'Manifest'),
verify_openpgp=True,
openpgp_env=self.env)
except gemato.exceptions.OpenPGPNoImplementation as e:
raise unittest.SkipTest(str(e))
finally:
shutil.rmtree(d)
def test_recursive_manifest_loader_compressed(self):
d = tempfile.mkdtemp()
try:
with gemato.compression.open_potentially_compressed_path(
os.path.join(d, 'Manifest.gz'), 'w') as cf:
cf.write(SIGNED_MANIFEST)
try:
self.assertRaises(self.expected_exception,
gemato.recursiveloader.ManifestRecursiveLoader,
os.path.join(d, 'Manifest.gz'),
verify_openpgp=True,
openpgp_env=self.env)
except gemato.exceptions.OpenPGPNoImplementation as e:
raise unittest.SkipTest(str(e))
finally:
shutil.rmtree(d)
def test_find_top_level_manifest(self):
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(SIGNED_MANIFEST)
self.assertEqual(
gemato.find_top_level.find_top_level_manifest(d),
os.path.join(d, 'Manifest'))
finally:
shutil.rmtree(d)
class OpenPGPExpiredKeyTest(OpenPGPNoKeyTest):
"""
Tests performed with an expired OpenPGP key.
"""
expected_exception = gemato.exceptions.OpenPGPExpiredKeyFailure
def setUp(self):
self.env = gemato.openpgp.OpenPGPEnvironment()
try:
self.env.import_key(io.BytesIO(EXPIRED_PUBLIC_KEY))
except gemato.exceptions.OpenPGPNoImplementation as e:
self.env.close()
raise unittest.SkipTest(str(e))
except RuntimeError:
self.env.close()
raise unittest.SkipTest('Unable to import OpenPGP key')
def tearDown(self):
self.env.close()
class OpenPGPRevokedKeyTest(OpenPGPNoKeyTest):
"""
Tests performed with a revoked OpenPGP key.
"""
expected_exception = gemato.exceptions.OpenPGPRevokedKeyFailure
def setUp(self):
self.env = gemato.openpgp.OpenPGPEnvironment()
try:
self.env.import_key(io.BytesIO(REVOKED_PUBLIC_KEY))
except gemato.exceptions.OpenPGPNoImplementation as e:
self.env.close()
raise unittest.SkipTest(str(e))
except RuntimeError:
self.env.close()
raise unittest.SkipTest('Unable to import OpenPGP key')
def tearDown(self):
self.env.close()
class OpenPGPContextManagerTest(unittest.TestCase):
"""
Test the context manager API for OpenPGPEnvironment.
"""
def test_import_key(self):
with gemato.openpgp.OpenPGPEnvironment() as env:
try:
env.import_key(io.BytesIO(PUBLIC_KEY))
except gemato.exceptions.OpenPGPNoImplementation as e:
raise unittest.SkipTest(str(e))
def test_import_malformed_key(self):
with gemato.openpgp.OpenPGPEnvironment() as env:
try:
self.assertRaises(RuntimeError,
env.import_key,
io.BytesIO(MALFORMED_PUBLIC_KEY))
except gemato.exceptions.OpenPGPNoImplementation as e:
raise unittest.SkipTest(str(e))
def test_import_no_keys(self):
with gemato.openpgp.OpenPGPEnvironment() as env:
try:
self.assertRaises(RuntimeError,
env.import_key,
io.BytesIO(b''))
except gemato.exceptions.OpenPGPNoImplementation as e:
raise unittest.SkipTest(str(e))
def test_import_binary_key(self):
with gemato.openpgp.OpenPGPEnvironment() as env:
enc = b''.join(PUBLIC_KEY.splitlines()[2:-1])
try:
env.import_key(io.BytesIO(base64.b64decode(enc)))
except gemato.exceptions.OpenPGPNoImplementation as e:
raise unittest.SkipTest(str(e))
def test_verify_manifest(self):
with io.StringIO(SIGNED_MANIFEST) as f:
with gemato.openpgp.OpenPGPEnvironment() as env:
try:
try:
env.import_key(io.BytesIO(PUBLIC_KEY))
except RuntimeError:
raise unittest.SkipTest('Unable to import OpenPGP key')
sig = env.verify_file(f)
self.assertEqual(sig.fingerprint, KEY_FINGERPRINT)
self.assertEqual(sig.timestamp, SIG_TIMESTAMP)
self.assertIsNone(sig.expire_timestamp)
self.assertEqual(sig.primary_key_fingerprint, KEY_FINGERPRINT)
except gemato.exceptions.OpenPGPNoImplementation as e:
raise unittest.SkipTest(str(e))
def test_double_close(self):
with gemato.openpgp.OpenPGPEnvironment() as env:
env.close()
def test_home_after_close(self):
with gemato.openpgp.OpenPGPEnvironment() as env:
env.close()
with self.assertRaises(RuntimeError):
env.home
class OpenPGPPrivateKeyTest(unittest.TestCase):
"""
Tests performed with the private key available.
"""
TEST_STRING = u'The quick brown fox jumps over the lazy dog'
def setUp(self):
self.env = gemato.openpgp.OpenPGPEnvironment()
try:
self.env.import_key(io.BytesIO(PRIVATE_KEY))
except gemato.exceptions.OpenPGPNoImplementation as e:
self.env.close()
raise unittest.SkipTest(str(e))
except RuntimeError:
self.env.close()
raise unittest.SkipTest('Unable to import OpenPGP key')
def tearDown(self):
self.env.close()
def test_verify_manifest(self):
with io.StringIO(SIGNED_MANIFEST) as f:
sig = self.env.verify_file(f)
self.assertEqual(sig.fingerprint, KEY_FINGERPRINT)
self.assertEqual(sig.timestamp, SIG_TIMESTAMP)
self.assertIsNone(sig.expire_timestamp)
self.assertEqual(sig.primary_key_fingerprint, KEY_FINGERPRINT)
def test_sign_data(self):
with io.StringIO(self.TEST_STRING) as f:
with io.StringIO() as wf:
self.env.clear_sign_file(f, wf)
wf.seek(0)
self.env.verify_file(wf)
def test_sign_data_keyid(self):
with io.StringIO(self.TEST_STRING) as f:
with io.StringIO() as wf:
self.env.clear_sign_file(f, wf, keyid=PRIVATE_KEY_ID)
wf.seek(0)
self.env.verify_file(wf)
def test_dump_signed_manifest(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(SIGNED_MANIFEST) as f:
m.load(f, openpgp_env=self.env)
with io.StringIO() as f:
m.dump(f, openpgp_env=self.env)
f.seek(0)
m.load(f, openpgp_env=self.env)
self.assertTrue(m.openpgp_signed)
self.assertIsNotNone(m.openpgp_signature)
def test_dump_signed_manifest_keyid(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(SIGNED_MANIFEST) as f:
m.load(f, openpgp_env=self.env)
with io.StringIO() as f:
m.dump(f, openpgp_keyid=PRIVATE_KEY_ID, openpgp_env=self.env)
f.seek(0)
m.load(f, openpgp_env=self.env)
self.assertTrue(m.openpgp_signed)
self.assertIsNotNone(m.openpgp_signature)
def test_dump_force_signed_manifest(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(SIGNED_MANIFEST) as f:
m.load(f, verify_openpgp=False, openpgp_env=self.env)
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
with io.StringIO() as f:
m.dump(f, sign_openpgp=True, openpgp_env=self.env)
f.seek(0)
m.load(f, openpgp_env=self.env)
self.assertTrue(m.openpgp_signed)
self.assertIsNotNone(m.openpgp_signature)
def test_dump_force_unsigned_manifest(self):
m = gemato.manifest.ManifestFile()
with io.StringIO(SIGNED_MANIFEST) as f:
m.load(f, openpgp_env=self.env)
self.assertTrue(m.openpgp_signed)
with io.StringIO() as f:
m.dump(f, sign_openpgp=False, openpgp_env=self.env)
f.seek(0)
m.load(f, openpgp_env=self.env)
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
def test_recursive_manifest_loader_save_manifest(self):
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(SIGNED_MANIFEST)
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(d, 'Manifest'),
verify_openpgp=True,
openpgp_env=self.env)
self.assertTrue(m.openpgp_signed)
m.save_manifest('Manifest')
m2 = gemato.manifest.ManifestFile()
with io.open(os.path.join(d, 'Manifest'), 'r') as f:
m2.load(f, openpgp_env=self.env)
self.assertTrue(m2.openpgp_signed)
self.assertIsNotNone(m.openpgp_signature)
finally:
shutil.rmtree(d)
def test_recursive_manifest_loader_save_manifest_compressed(self):
d = tempfile.mkdtemp()
try:
with gemato.compression.open_potentially_compressed_path(
os.path.join(d, 'Manifest.gz'), 'w') as cf:
cf.write(SIGNED_MANIFEST)
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(d, 'Manifest.gz'),
verify_openpgp=True,
openpgp_env=self.env)
self.assertTrue(m.openpgp_signed)
m.save_manifest('Manifest.gz')
m2 = gemato.manifest.ManifestFile()
with gemato.compression.open_potentially_compressed_path(
os.path.join(d, 'Manifest.gz'), 'r') as cf:
m2.load(cf, openpgp_env=self.env)
self.assertTrue(m2.openpgp_signed)
self.assertIsNotNone(m.openpgp_signature)
finally:
shutil.rmtree(d)
def test_recursive_manifest_loader_save_manifest_force_sign(self):
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(SIGNED_MANIFEST)
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(d, 'Manifest'),
verify_openpgp=False,
sign_openpgp=True,
openpgp_env=self.env)
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
m.save_manifest('Manifest')
m2 = gemato.manifest.ManifestFile()
with io.open(os.path.join(d, 'Manifest'), 'r') as f:
m2.load(f, openpgp_env=self.env)
self.assertTrue(m2.openpgp_signed)
self.assertIsNotNone(m2.openpgp_signature)
finally:
shutil.rmtree(d)
def test_recursive_manifest_loader_save_manifest_compressed_force_sign(self):
d = tempfile.mkdtemp()
try:
with gemato.compression.open_potentially_compressed_path(
os.path.join(d, 'Manifest.gz'), 'w') as cf:
cf.write(SIGNED_MANIFEST)
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(d, 'Manifest.gz'),
verify_openpgp=False,
sign_openpgp=True,
openpgp_env=self.env)
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
m.save_manifest('Manifest.gz')
m2 = gemato.manifest.ManifestFile()
with gemato.compression.open_potentially_compressed_path(
os.path.join(d, 'Manifest.gz'), 'r') as cf:
m2.load(cf, openpgp_env=self.env)
self.assertTrue(m2.openpgp_signed)
self.assertIsNotNone(m2.openpgp_signature)
finally:
shutil.rmtree(d)
def test_recursive_manifest_loader_save_submanifest_force_sign(self):
"""
Test that sub-Manifests are not signed.
"""
d = tempfile.mkdtemp()
try:
with io.open(os.path.join(d, 'Manifest'), 'w') as f:
f.write(SIGNED_MANIFEST)
os.mkdir(os.path.join(d, 'eclass'))
with io.open(os.path.join(d, 'eclass/Manifest'), 'w'):
pass
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(d, 'Manifest'),
verify_openpgp=False,
sign_openpgp=True,
openpgp_env=self.env)
self.assertFalse(m.openpgp_signed)
self.assertIsNone(m.openpgp_signature)
m.load_manifest('eclass/Manifest')
m.save_manifest('eclass/Manifest')
m2 = gemato.manifest.ManifestFile()
with io.open(os.path.join(d, 'eclass/Manifest'), 'r') as f:
m2.load(f, openpgp_env=self.env)
self.assertFalse(m2.openpgp_signed)
self.assertIsNone(m2.openpgp_signature)
finally:
shutil.rmtree(d)
|