3 # Copyright 2014 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 two chains of test certificates:
9 # 1. A (end-entity) -> B -> C -> D (self-signed root)
10 # 2. A (end-entity) -> B -> C2 -> E (self-signed root)
12 # C and C2 have the same subject and keypair.
14 # We use these cert chains in CertVerifyProcChromeOSTest
15 # to ensure that multiple verification paths are properly handled.
25 echo Create the serial number files.
29 try
/bin
/sh
-c "echo $serial > out/$i-serial"
30 serial
=$
(expr $serial + 1)
33 echo Generate the keys.
34 try openssl genrsa
-out out
/A.key
2048
35 try openssl genrsa
-out out
/B.key
2048
36 try openssl genrsa
-out out
/C.key
2048
37 try openssl genrsa
-out out
/D.key
2048
38 try openssl genrsa
-out out
/E.key
2048
40 echo Generate the D CSR.
41 CA_COMMON_NAME
="D Root CA" \
47 -config redundant-ca.cnf
50 CA_COMMON_NAME
="D Root CA" \
55 -extfile redundant-ca.cnf \
60 echo Generate the E CSR.
61 CA_COMMON_NAME
="E Root CA" \
67 -config redundant-ca.cnf
70 CA_COMMON_NAME
="E Root CA" \
75 -extfile redundant-ca.cnf \
80 echo Generate the C2 intermediary CSR.
81 CA_COMMON_NAME
="C CA" \
87 -config redundant-ca.cnf
89 echo Generate the B and C intermediaries
\' CSRs.
92 CA_COMMON_NAME
="$i CA" \
98 -config redundant-ca.cnf
101 echo D signs the C intermediate.
102 # Make sure the signer's DB file exists.
103 touch out
/D-index.txt
104 CA_COMMON_NAME
="D Root CA" \
108 -extensions ca_cert \
111 -config redundant-ca.cnf
113 echo E signs the C2 intermediate.
114 # Make sure the signer's DB file exists.
115 touch out
/E-index.txt
116 CA_COMMON_NAME
="E Root CA" \
120 -extensions ca_cert \
123 -config redundant-ca.cnf
125 echo C signs the B intermediate.
126 touch out
/C-index.txt
127 CA_COMMON_NAME
="C CA" \
131 -extensions ca_cert \
134 -config redundant-ca.cnf
136 echo Generate the A end-entity CSR.
144 touch out
/B-index.txt
145 CA_COMMON_NAME
="B CA" \
149 -extensions user_cert \
152 -config redundant-ca.cnf
154 echo Create multi-root-chain1.pem
155 try
/bin
/sh
-c "cat out/A.key out/A.pem out/B.pem out/C.pem out/D.pem \
156 > ../certificates/multi-root-chain1.pem"
158 echo Create multi-root-chain2.pem
159 try
/bin
/sh
-c "cat out/A.key out/A.pem out/B.pem out/C2.pem out/E.pem \
160 > ../certificates/multi-root-chain2.pem"