OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2017 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2017 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 """Generates a variety of chains where the target certificate varies in its key | 6 """Generates a variety of chains where the target certificate varies in its key |
7 type and key usages.""" | 7 type and key usages.""" |
8 | 8 |
9 import sys | 9 import sys |
10 sys.path += ['..'] | 10 sys.path += ['..'] |
(...skipping 29 matching lines...) Expand all Loading... |
40 target = common.create_end_entity_certificate('Target', intermediate) | 40 target = common.create_end_entity_certificate('Target', intermediate) |
41 target.get_extensions().set_property('extendedKeyUsage', 'serverAuth') | 41 target.get_extensions().set_property('extendedKeyUsage', 'serverAuth') |
42 target.get_extensions().set_property('keyUsage', | 42 target.get_extensions().set_property('keyUsage', |
43 'critical,%s' % (key_usage)) | 43 'critical,%s' % (key_usage)) |
44 | 44 |
45 # Set the key. | 45 # Set the key. |
46 target.set_key(KEYS[key_type]) | 46 target.set_key(KEYS[key_type]) |
47 | 47 |
48 # Write the chain. | 48 # Write the chain. |
49 chain = [target, intermediate, root] | 49 chain = [target, intermediate, root] |
50 description = ('Certificate chain where the target uses a %s key and has ' | 50 description = ('Certificate chain where the target certificate uses a %s ' |
51 'the single key usage %s') % (key_type.upper(), key_usage) | 51 'key and has the single key usage %s') % (key_type.upper(), |
| 52 key_usage) |
52 common.write_chain(description, chain, '%s-%s.pem' % (key_type, key_usage)) | 53 common.write_chain(description, chain, '%s-%s.pem' % (key_type, key_usage)) |
OLD | NEW |