OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2015 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 """Certificate chain with a root, intermediate and target. The intermediate has | 6 """Certificate chain where the intermediate has a smaller validity range |
7 a smaller validity range than the other certificates, making it easy to violate | 7 than the other certificates, making it easy to violate just its validity. |
8 just its validity. | |
9 | 8 |
10 Root: 2015/01/01 -> 2016/01/01 | 9 Root: 2015/01/01 -> 2016/01/01 |
11 Intermediate: 2015/03/01 -> 2015/09/01 | 10 Intermediate: 2015/03/01 -> 2015/09/01 |
12 Target: 2015/01/01 -> 2016/01/01 | 11 Target: 2015/01/01 -> 2016/01/01 |
13 """ | 12 """ |
14 | 13 |
15 import sys | 14 import sys |
16 sys.path += ['..'] | 15 sys.path += ['..'] |
17 | 16 |
18 import common | 17 import common |
19 | 18 |
20 # Self-signed root certificate. | 19 # Self-signed root certificate. |
21 root = common.create_self_signed_root_certificate('Root') | 20 root = common.create_self_signed_root_certificate('Root') |
22 root.set_validity_range(common.JANUARY_1_2015_UTC, common.JANUARY_1_2016_UTC) | 21 root.set_validity_range(common.JANUARY_1_2015_UTC, common.JANUARY_1_2016_UTC) |
23 | 22 |
24 # Intermediate certificate. | 23 # Intermediate certificate. |
25 intermediate = common.create_intermediate_certificate('Intermediate', root) | 24 intermediate = common.create_intermediate_certificate('Intermediate', root) |
26 intermediate.set_validity_range(common.MARCH_1_2015_UTC, | 25 intermediate.set_validity_range(common.MARCH_1_2015_UTC, |
27 common.SEPTEMBER_1_2015_UTC) | 26 common.SEPTEMBER_1_2015_UTC) |
28 | 27 |
29 # Target certificate. | 28 # Target certificate. |
30 target = common.create_end_entity_certificate('Target', intermediate) | 29 target = common.create_end_entity_certificate('Target', intermediate) |
31 target.set_validity_range(common.JANUARY_1_2015_UTC, common.JANUARY_1_2016_UTC) | 30 target.set_validity_range(common.JANUARY_1_2015_UTC, common.JANUARY_1_2016_UTC) |
32 | 31 |
33 chain = [target, intermediate, root] | 32 chain = [target, intermediate, root] |
34 common.write_chain(__doc__, chain, 'chain.pem') | 33 common.write_chain(__doc__, chain, 'chain.pem') |
OLD | NEW |