Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(631)

Side by Side Diff: net/data/cert_issuer_source_static_unittest/generate-certs.py

Issue 2535733003: pki library: Add CertIssuerSourceNSS that retrieves intermediate certs from NSS. (Closed)
Patch Set: review changes Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Certificates for testing issuer lookup. 6 """Certificates for testing issuer lookup.
7 7
8 Root 8 Root
9 /| | 9 /| | |\\
10 / | | 10 / | | | \\
11 / | | 11 / | | | \\
12 / | | 12 / | | | \\
13 / | | 13 / | | | \\
14 v v v 14 v v v v v
15 I1_1 i1_2 I2 15 I1_1 i1_2 I2 I3_1 I3_2
16 | | | 16 | | | | |
17 | | | 17 | | | | |
18 | | | 18 | | | | |
19 | | | 19 | | | | |
20 v v v 20 v v v | |
21 C1 C2 D 21 C1 C2 D E1 E2
22 22
23 I1 (i1_1.pem) and i1 (i1_2.pem) have subjects that are equal after 23 I1 (i1_1.pem) and i1 (i1_2.pem) have subjects that are equal after
24 normalization. 24 normalization.
25 25
26 I3_1 and I3_2 have subjects that are exactly equal.
27
26 C1 and C2 should (attempt to) chain up through both I1 and i1, since I1 and i1 28 C1 and C2 should (attempt to) chain up through both I1 and i1, since I1 and i1
27 have the same the name (after normalization). 29 have the same the name (after normalization).
30
31 E1 and E3 should (attempt to) chain up through both I3 intermediates.
28 """ 32 """
29 33
30 import os 34 import os
31 import sys 35 import sys
32 sys.path += [os.path.join('..', 'verify_certificate_chain_unittest')] 36 sys.path += [os.path.join('..', 'verify_certificate_chain_unittest')]
33 37
34 import common 38 import common
35 39
36 40
37 def write_cert_to_file(cert, filename): 41 def write_cert_to_file(cert, filename):
(...skipping 14 matching lines...) Expand all
52 write_cert_to_file(i1_1, 'i1_1.pem') 56 write_cert_to_file(i1_1, 'i1_1.pem')
53 57
54 # same name (after normalization), different key 58 # same name (after normalization), different key
55 i1_2 = common.create_intermediate_certificate('i1', root) 59 i1_2 = common.create_intermediate_certificate('i1', root)
56 write_cert_to_file(i1_2, 'i1_2.pem') 60 write_cert_to_file(i1_2, 'i1_2.pem')
57 61
58 # different name 62 # different name
59 i2 = common.create_intermediate_certificate('I2', root) 63 i2 = common.create_intermediate_certificate('I2', root)
60 write_cert_to_file(i2, 'i2.pem') 64 write_cert_to_file(i2, 'i2.pem')
61 65
66 # Two intermediates with exactly the same name.
67 i3_1 = common.create_intermediate_certificate('I3', root)
68 write_cert_to_file(i3_1, 'i3_1.pem')
69 i3_2 = common.create_intermediate_certificate('I3', root)
70 write_cert_to_file(i3_2, 'i3_2.pem')
62 71
63 # target certs 72 # target certs
64 73
65 c1 = common.create_end_entity_certificate('C1', i1_1) 74 c1 = common.create_end_entity_certificate('C1', i1_1)
66 write_cert_to_file(c1, 'c1.pem') 75 write_cert_to_file(c1, 'c1.pem')
67 76
68 c2 = common.create_end_entity_certificate('C2', i1_2) 77 c2 = common.create_end_entity_certificate('C2', i1_2)
69 write_cert_to_file(c2, 'c2.pem') 78 write_cert_to_file(c2, 'c2.pem')
70 79
71 d = common.create_end_entity_certificate('D', i2) 80 d = common.create_end_entity_certificate('D', i2)
72 write_cert_to_file(d, 'd.pem') 81 write_cert_to_file(d, 'd.pem')
73 82
83 e1 = common.create_end_entity_certificate('E1', i3_1)
84 write_cert_to_file(e1, 'e1.pem')
74 85
86 e2 = common.create_end_entity_certificate('E2', i3_2)
87 write_cert_to_file(e2, 'e2.pem')
88
OLDNEW
« no previous file with comments | « net/data/cert_issuer_source_static_unittest/e2.pem ('k') | net/data/cert_issuer_source_static_unittest/i1_1.pem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698