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

Side by Side Diff: net/data/cert_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: . 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 v v v
13 B1 b1 B2
14 |\/| |
15 |/\| |
16 v v v
17 C C' C''
18
19 B1 and b1 have the same key, and their subjects are also equal (after
20 normalization).
21
22 C, C', and C'' all have the same subject but different keys (doesn't matter for
23 this test).
24
25 C and C' should chain up through both B1 and b1, since they have the same key
26 and the names are equal after normalization.
27 """
28
29 import os
30 import sys
31 sys.path += [os.path.join('..', 'verify_certificate_chain_unittest')]
32
33 import common
34
35
36 def write_cert_to_file(cert, filename):
37 common.write_string_to_file(__doc__ + "\n" + cert.get_cert_pem(), filename)
38
39
40 # Self-signed root certificate
41 root = common.create_self_signed_root_certificate('Root')
42 write_cert_to_file(root, 'root.pem')
43
44
45 # Intermediary certificates
46 B1_1 = common.create_intermediary_certificate('B1', root)
47 write_cert_to_file(B1_1, 'b1_1.pem')
eroman 2016/06/01 20:52:10 I didn't find the names easy to follow between the
mattm 2016/06/01 22:20:41 Done.
48
49 # same name (after normalization), different key
50 B1_2 = common.create_intermediary_certificate('b1', root)
51 write_cert_to_file(B1_2, 'b1_2.pem')
52
53 # different name
54 B2_1 = common.create_intermediary_certificate('B2', root)
55 write_cert_to_file(B2_1, 'b2_1.pem')
56
57
58 # target certs
59
60 c1_1 = common.create_end_entity_certificate('C', B1_1)
61 write_cert_to_file(c1_1, 'c1_1.pem')
62
63 c1_2 = common.create_end_entity_certificate('C', B1_2)
64 write_cert_to_file(c1_2, 'c1_2.pem')
65
66 c2_1 = common.create_end_entity_certificate('C', B2_1)
67 write_cert_to_file(c2_1, 'c2_1.pem')
68
69
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698