OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 |
| 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. |
| 6 |
| 7 # This script generates a set of test (end-entity, intermediate, root) |
| 8 # certificates that can be used to test fetching of an intermediate via AIA. |
| 9 |
| 10 try() { |
| 11 echo "$@" |
| 12 $@ || exit 1 |
| 13 } |
| 14 |
| 15 try rm -rf out |
| 16 try mkdir out |
| 17 |
| 18 try echo 1 > out/2048-sha1-root-serial |
| 19 touch out/2048-sha1-root-index.txt |
| 20 |
| 21 # Generate the key |
| 22 try openssl genrsa -out out/2048-sha1-root.key 2048 |
| 23 |
| 24 # Generate the root certificate |
| 25 CA_COMMON_NAME="Test Root CA" \ |
| 26 try openssl req \ |
| 27 -new \ |
| 28 -key out/2048-sha1-root.key \ |
| 29 -out out/2048-sha1-root.req \ |
| 30 -config ca.cnf |
| 31 |
| 32 CA_COMMON_NAME="Test Root CA" \ |
| 33 try openssl x509 \ |
| 34 -req -days 3650 \ |
| 35 -in out/2048-sha1-root.req \ |
| 36 -out out/2048-sha1-root.pem \ |
| 37 -signkey out/2048-sha1-root.key \ |
| 38 -extfile ca.cnf \ |
| 39 -extensions ca_cert |
| 40 |
| 41 # Generate the leaf certificate requests |
| 42 try openssl req \ |
| 43 -new \ |
| 44 -keyout out/expired_cert.key \ |
| 45 -out out/expired_cert.req \ |
| 46 -config ee.cnf |
| 47 |
| 48 try openssl req \ |
| 49 -new \ |
| 50 -keyout out/ok_cert.key \ |
| 51 -out out/ok_cert.req \ |
| 52 -config ee.cnf |
| 53 |
| 54 # Generate the leaf certificates |
| 55 CA_COMMON_NAME="Test Root CA" \ |
| 56 try openssl ca \ |
| 57 -batch \ |
| 58 -extensions user_cert \ |
| 59 -startdate 060101000000Z \ |
| 60 -enddate 070101000000Z \ |
| 61 -in out/expired_cert.req \ |
| 62 -out out/expired_cert.pem \ |
| 63 -config ca.cnf |
| 64 |
| 65 CA_COMMON_NAME="Test Root CA" \ |
| 66 try openssl ca \ |
| 67 -batch \ |
| 68 -extensions user_cert \ |
| 69 -days 3650 \ |
| 70 -in out/ok_cert.req \ |
| 71 -out out/ok_cert.pem \ |
| 72 -config ca.cnf |
| 73 |
| 74 cat out/ok_cert.key out/ok_cert.pem > ../certificates/ok_cert.pem |
| 75 cat out/expired_cert.key out/expired_cert.pem > ../certificates/expired_cert.pem |
| 76 cat out/2048-sha1-root.key out/2048-sha1-root.pem > ../certificates/root_ca_cert
.pem |
| 77 |
OLD | NEW |