OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # This script generates certificates that can be used to test SSL client | 7 # This script generates certificates that can be used to test SSL client |
8 # authentication. Outputs for automated tests are stored in | 8 # authentication. Outputs for automated tests are stored in |
9 # net/data/ssl/certificates, but may be re-generated for manual testing. | 9 # net/data/ssl/certificates, but may be re-generated for manual testing. |
10 # | 10 # |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 echo Generate the leaf certs | 106 echo Generate the leaf certs |
107 for id in A D | 107 for id in A D |
108 do | 108 do |
109 COMMON_NAME="Client Cert $id" \ | 109 COMMON_NAME="Client Cert $id" \ |
110 ID=$id \ | 110 ID=$id \ |
111 try openssl req \ | 111 try openssl req \ |
112 -new \ | 112 -new \ |
113 -key out/$id.key \ | 113 -key out/$id.key \ |
114 -out out/$id.csr \ | 114 -out out/$id.csr \ |
115 -config client-certs.cnf | 115 -config client-certs.cnf |
| 116 # Store the private key also in PKCS#8 format. |
| 117 try openssl pkcs8 \ |
| 118 -topk8 -nocrypt \ |
| 119 -in out/$id.key \ |
| 120 -outform DER \ |
| 121 -out out/$id.pk8 |
116 done | 122 done |
117 | 123 |
118 echo B signs A | 124 echo B signs A |
119 COMMON_NAME="B CA" \ | 125 COMMON_NAME="B CA" \ |
120 CA_DIR=out \ | 126 CA_DIR=out \ |
121 ID=B \ | 127 ID=B \ |
122 try openssl ca \ | 128 try openssl ca \ |
123 -batch \ | 129 -batch \ |
124 -extensions user_cert \ | 130 -extensions user_cert \ |
125 -in out/A.csr \ | 131 -in out/A.csr \ |
(...skipping 24 matching lines...) Expand all Loading... |
150 | 156 |
151 try openssl pkcs12 \ | 157 try openssl pkcs12 \ |
152 -in out/D-chain.pem \ | 158 -in out/D-chain.pem \ |
153 -out client_2.p12 \ | 159 -out client_2.p12 \ |
154 -export \ | 160 -export \ |
155 -passout pass:chrome | 161 -passout pass:chrome |
156 | 162 |
157 echo Package the client certs for unit tests | 163 echo Package the client certs for unit tests |
158 try cp out/A.pem ../certificates/client_1.pem | 164 try cp out/A.pem ../certificates/client_1.pem |
159 try cp out/A.key ../certificates/client_1.key | 165 try cp out/A.key ../certificates/client_1.key |
| 166 try cp out/A.pk8 ../certificates/client_1.pk8 |
160 try cp out/B.pem ../certificates/client_1_ca.pem | 167 try cp out/B.pem ../certificates/client_1_ca.pem |
161 | 168 |
162 try cp out/D.pem ../certificates/client_2.pem | 169 try cp out/D.pem ../certificates/client_2.pem |
163 try cp out/D.key ../certificates/client_2.key | 170 try cp out/D.key ../certificates/client_2.key |
| 171 try cp out/D.pk8 ../certificates/client_2.pk8 |
164 try cp out/E.pem ../certificates/client_2_ca.pem | 172 try cp out/E.pem ../certificates/client_2_ca.pem |
OLD | NEW |