3 # Copyright (c) 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 two chains of test certificates:
8 # 1. A1 (end-entity) -> B (self-signed root)
9 # 2. A2 (end-entity) -> B (self-signed root)
11 # In which A1 and A2 share the same key, the same subject common name, but have
12 # distinct O values in their subjects.
14 # This is used to test that NSS can properly generate unique certificate
15 # nicknames for both certificates.
25 echo Create the serial number and index files.
26 try
/bin
/sh
-c "echo 01 > out/B-serial"
27 try
touch out
/B-index.txt
29 echo Generate the keys.
30 try openssl genrsa
-out out
/A.key
2048
31 try openssl genrsa
-out out
/B.key
2048
33 echo Generate the B CSR.
34 CA_COMMON_NAME
="B Root CA" \
40 -config redundant-ca.cnf
43 CA_COMMON_NAME
="B Root CA" \
47 -extfile redundant-ca.cnf \
52 echo Generate the A1 end-entity CSR.
53 SUBJECT_NAME
=req_duplicate_cn_1 \
60 echo Generate the A2 end-entity CSR
61 SUBJECT_NAME
=req_duplicate_cn_2 \
70 CA_COMMON_NAME
="B CA" \
74 -extensions user_cert \
77 -config redundant-ca.cnf
80 CA_COMMON_NAME
="B CA" \
84 -extensions user_cert \
87 -config redundant-ca.cnf
89 echo Exporting the certificates to PKCS
#12
94 -out ..
/certificates
/duplicate_cn_1.p12 \
101 -out ..
/certificates
/duplicate_cn_2.p12 \
104 try
cp out
/A1.pem ..
/certificates
/duplicate_cn_1.pem
105 try
cp out
/A2.pem ..
/certificates
/duplicate_cn_2.pem