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