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

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

Issue 2030693002: Add CertIssuerSource interface and CertIssuerSourceStatic implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert-parsing-base
Patch Set: renamed Created 4 years, 6 months 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
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5
6 """Certificates for testing issuer lookup.
7
8 Root
9 /| |
10 / | |
11 / | |
12 / | |
13 / | |
14 v v v
15 I1_1 i1_2 I2
16 | | |
17 | | |
18 | | |
19 | | |
20 v v v
21 C1 C2 D
22
23 I1 (i1_1.pem) and i1 (i1_2.pem) have subjects that are equal after
eroman 2016/06/01 23:30:23 are these names updated? (I don't see i1 in the di
mattm 2016/06/01 23:48:33 That's i1_2 in the diagram. I can't have the diagr
24 normalization.
25
26 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).
28 """
29
30 import os
31 import sys
32 sys.path += [os.path.join('..', 'verify_certificate_chain_unittest')]
33
34 import common
35
36
37 def write_cert_to_file(cert, filename):
38 common.write_string_to_file(
39 "Generated by %s.\n"
40 "Refer to generator script docstring for details.\n%s" % (
41 sys.argv[0], cert.get_cert_pem()),
42 filename)
43
44
45 # Self-signed root certificate
46 root = common.create_self_signed_root_certificate('Root')
47 write_cert_to_file(root, 'root.pem')
48
49
50 # Intermediary certificates
51 i1_1 = common.create_intermediary_certificate('I1', root)
52 write_cert_to_file(i1_1, 'i1_1.pem')
53
54 # same name (after normalization), different key
55 i1_2 = common.create_intermediary_certificate('i1', root)
56 write_cert_to_file(i1_2, 'i1_2.pem')
57
58 # different name
59 i2 = common.create_intermediary_certificate('I2', root)
60 write_cert_to_file(i2, 'i2.pem')
61
62
63 # target certs
64
65 c1 = common.create_end_entity_certificate('C1', i1_1)
66 write_cert_to_file(c1, 'c1.pem')
67
68 c2 = common.create_end_entity_certificate('C2', i1_2)
69 write_cert_to_file(c2, 'c2.pem')
70
71 d = common.create_end_entity_certificate('D', i2)
72 write_cert_to_file(d, 'd.pem')
73
74
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698