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 set of test (end-entity, root) certificate chains
8 # whose EEs have (critical, non-critical) eKUs for codeSigning. We then try
9 # to use them as EEs for a web server in unit tests, to make sure that we
10 # don't accept such certs as web server certs.
20 eku_test_root
="2048-rsa-root"
22 # Create the serial number files.
23 try
/bin
/sh
-c "echo 01 > \"out/$eku_test_root-serial\""
25 # Make sure the signers' DB files exist.
26 touch "out/$eku_test_root-index.txt"
28 # Generate one root CA certificate.
29 try openssl genrsa
-out "out/$eku_test_root.key" 2048
31 CA_COMMON_NAME
="2048 RSA Test Root CA" \
39 -key "out/$eku_test_root.key" \
41 -out "out/$eku_test_root.csr" \
44 CA_COMMON_NAME
="2048 RSA Test Root CA" \
49 -in "out/$eku_test_root.csr" \
52 -signkey "out/$eku_test_root.key" \
53 -out "out/$eku_test_root.pem" \
57 for cert_type
in non-crit-codeSigning crit-codeSigning
59 try openssl genrsa
-out "out/$cert_type.key" 2048
63 -key "out/$cert_type.key" \
64 -out "out/$cert_type.csr" \
65 -config eku-test.cnf \
68 CA_COMMON_NAME
="2048 rsa Test Root CA" \
76 -in "out/$cert_type.csr" \
77 -out "out/$cert_type.pem" \
81 # Copy to the file names that are actually checked in.
82 try
cp "out/$eku_test_root.pem" ..
/certificates
/eku-test-root.pem
83 try
/bin
/sh
-c "cat out/crit-codeSigning.key out/crit-codeSigning.pem \
84 > ../certificates/crit-codeSigning-chain.pem"
85 try
/bin
/sh
-c "cat out/non-crit-codeSigning.key out/non-crit-codeSigning.pem \
86 > ../certificates/non-crit-codeSigning-chain.pem"