| 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 1 intermediate, a trusted root, and a target | 6 """Certificate chain where the leaf certificate asserts the keyCertSign key |
| 7 certificate that is not a CA, and yet has the keyCertSign bit set. Verification | 7 usage, however does not have CA=true in the basic constraints extension to |
| 8 is expected to fail, since keyCertSign should only be asserted when CA is | 8 indicate it is a CA.""" |
| 9 true.""" | |
| 10 | 9 |
| 11 import sys | 10 import sys |
| 12 sys.path += ['..'] | 11 sys.path += ['..'] |
| 13 | 12 |
| 14 import common | 13 import common |
| 15 | 14 |
| 16 # Self-signed root certificate (used as trust anchor). | 15 # Self-signed root certificate. |
| 17 root = common.create_self_signed_root_certificate('Root') | 16 root = common.create_self_signed_root_certificate('Root') |
| 18 | 17 |
| 19 # Intermediate certificate. | 18 # Intermediate certificate. |
| 20 intermediate = common.create_intermediate_certificate('Intermediate', root) | 19 intermediate = common.create_intermediate_certificate('Intermediate', root) |
| 21 | 20 |
| 22 # Target certificate (end entity but has keyCertSign bit set). | 21 # Target certificate (end entity but has keyCertSign bit set). |
| 23 target = common.create_end_entity_certificate('Target', intermediate) | 22 target = common.create_end_entity_certificate('Target', intermediate) |
| 24 target.get_extensions().set_property('keyUsage', | 23 target.get_extensions().set_property('keyUsage', |
| 25 'critical,digitalSignature,keyEncipherment,keyCertSign') | 24 'critical,digitalSignature,keyEncipherment,keyCertSign') |
| 26 | 25 |
| 27 chain = [target, intermediate, root] | 26 chain = [target, intermediate, root] |
| 28 common.write_chain(__doc__, chain, 'chain.pem') | 27 common.write_chain(__doc__, chain, 'chain.pem') |
| OLD | NEW |