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
5 # found in the LICENSE file.
7 # This script generates a (end-entity, intermediate, root) certificate, where
8 # the root has no explicit policies associated, the intermediate has multiple
9 # policies, and the leaf has a single policy.
11 # When validating, supplying no policy OID should not result in an error.
21 # Create the serial number files.
22 try
echo 1 > out
/policy-root-serial
23 try
echo 1 > out
/policy-intermediate-serial
25 # Create the signers' DB files.
26 touch out
/policy-root-index.txt
27 touch out
/policy-intermediate-index.txt
30 try openssl genrsa
-out out
/policy-root.key
2048
31 try openssl genrsa
-out out
/policy-intermediate.key
2048
32 try openssl genrsa
-out out
/policy-cert.key
2048
34 # Generate the root certificate
35 COMMON_NAME
="Policy Test Root CA" \
40 -key out
/policy-root.key \
41 -out out
/policy-root.csr \
44 COMMON_NAME
="Policy Test Root CA" \
49 -in out
/policy-root.csr \
50 -out out
/policy-root.pem \
51 -signkey out
/policy-root.key \
55 # Generate the intermediate
56 COMMON_NAME
="Policy Test Intermediate CA" \
60 -key out
/policy-intermediate.key \
61 -out out
/policy-intermediate.csr \
64 COMMON_NAME
="UNUSED" \
69 -in out
/policy-intermediate.csr \
70 -out out
/policy-intermediate.pem \
72 -extensions intermediate_cert
75 COMMON_NAME
="policy_test.example" \
77 CA_NAME
=policy-intermediate \
80 -key out
/policy-cert.key \
81 -out out
/policy-cert.csr \
84 COMMON_NAME
="Policy Test Intermediate CA" \
86 CA_NAME
=policy-intermediate \
89 -in out
/policy-cert.csr \
90 -out out
/policy-cert.pem \
94 cat out
/policy-cert.pem \
95 out
/policy-intermediate.pem \
96 out
/policy-root.pem
>..
/certificates
/explicit-policy-chain.pem