OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # This script generates a (end-entity, intermediate, root) certificate, where | 7 # This script generates a (end-entity, intermediate, root) certificate, where |
8 # the root has no explicit policies associated, the intermediate has multiple | 8 # the root has no explicit policies associated, the intermediate has multiple |
9 # policies, and the leaf has a single policy. | 9 # policies, and the leaf has a single policy. |
10 # | 10 # |
11 # When validating, supplying no policy OID should not result in an error. | 11 # When validating, supplying no policy OID should not result in an error. |
12 | 12 |
13 try() { | 13 try() { |
14 echo "$@" | 14 "$@" || (e=$?; echo "$@" > /dev/stderr; exit $e) |
15 "$@" || exit 1 | |
16 } | 15 } |
17 | 16 |
18 try rm -rf out | 17 try rm -rf out |
19 try mkdir out | 18 try mkdir out |
20 | 19 |
21 # Create the serial number files. | 20 # Create the serial number files. |
22 try /bin/sh -c "echo 01 > out/policy-root-serial" | 21 try /bin/sh -c "echo 01 > out/policy-root-serial" |
23 try /bin/sh -c "echo 01 > out/policy-intermediate-serial" | 22 try /bin/sh -c "echo 01 > out/policy-intermediate-serial" |
24 | 23 |
25 # Create the signers' DB files. | 24 # Create the signers' DB files. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 try openssl ca \ | 87 try openssl ca \ |
89 -batch \ | 88 -batch \ |
90 -in out/policy-cert.csr \ | 89 -in out/policy-cert.csr \ |
91 -out out/policy-cert.pem \ | 90 -out out/policy-cert.pem \ |
92 -config policy.cnf \ | 91 -config policy.cnf \ |
93 -extensions user_cert | 92 -extensions user_cert |
94 | 93 |
95 try /bin/sh -c "cat out/policy-cert.pem \ | 94 try /bin/sh -c "cat out/policy-cert.pem \ |
96 out/policy-intermediate.pem \ | 95 out/policy-intermediate.pem \ |
97 out/policy-root.pem >../certificates/explicit-policy-chain.pem" | 96 out/policy-root.pem >../certificates/explicit-policy-chain.pem" |
OLD | NEW |