Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: net/data/ssl/scripts/generate-client-certificates.sh

Issue 1742853004: Add test client cert w/ SAN fields (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update more platform_keys test files Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/data/ssl/scripts/client-certs.cnf ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 serial=1000 30 serial=1000
31 for i in B C E 31 for i in B C E
32 do 32 do
33 try /bin/sh -c "echo $serial > out/$i-serial" 33 try /bin/sh -c "echo $serial > out/$i-serial"
34 serial=$(expr $serial + 1) 34 serial=$(expr $serial + 1)
35 touch out/$i-index.txt 35 touch out/$i-index.txt
36 touch out/$i-index.txt.attr 36 touch out/$i-index.txt.attr
37 done 37 done
38 38
39 echo Generate the keys. 39 echo Generate the keys.
40 for i in A B C D E 40 for i in A B C D E F
41 do 41 do
42 try openssl genrsa -out out/$i.key 2048 42 try openssl genrsa -out out/$i.key 2048
43 done 43 done
44 44
45 echo Generate the C CSR 45 echo Generate the C CSR
46 COMMON_NAME="C Root CA" \ 46 COMMON_NAME="C Root CA" \
47 CA_DIR=out \ 47 CA_DIR=out \
48 ID=C \ 48 ID=C \
49 try openssl req \ 49 try openssl req \
50 -new \ 50 -new \
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 CA_DIR=out \ 97 CA_DIR=out \
98 ID=C \ 98 ID=C \
99 try openssl ca \ 99 try openssl ca \
100 -batch \ 100 -batch \
101 -extensions ca_cert \ 101 -extensions ca_cert \
102 -in out/E.csr \ 102 -in out/E.csr \
103 -out out/E.pem \ 103 -out out/E.pem \
104 -config client-certs.cnf 104 -config client-certs.cnf
105 105
106 echo Generate the leaf certs 106 echo Generate the leaf certs
107 for id in A D 107 for id in A D F
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. 116 # Store the private key also in PKCS#8 format.
117 try openssl pkcs8 \ 117 try openssl pkcs8 \
(...skipping 18 matching lines...) Expand all
136 COMMON_NAME="E CA" \ 136 COMMON_NAME="E CA" \
137 CA_DIR=out \ 137 CA_DIR=out \
138 ID=E \ 138 ID=E \
139 try openssl ca \ 139 try openssl ca \
140 -batch \ 140 -batch \
141 -extensions user_cert \ 141 -extensions user_cert \
142 -in out/D.csr \ 142 -in out/D.csr \
143 -out out/D.pem \ 143 -out out/D.pem \
144 -config client-certs.cnf 144 -config client-certs.cnf
145 145
146 echo E signs F
147 COMMON_NAME="E CA" \
148 CA_DIR=out \
149 ID=E \
150 try openssl ca \
151 -batch \
152 -extensions san_user_cert \
153 -in out/F.csr \
154 -out out/F.pem \
155 -config client-certs.cnf
156
146 echo Package the client certs and private keys into PKCS12 files 157 echo Package the client certs and private keys into PKCS12 files
147 # This is done for easily importing all of the certs needed for clients. 158 # This is done for easily importing all of the certs needed for clients.
148 try /bin/sh -c "cat out/A.pem out/A.key out/B.pem out/C.pem > out/A-chain.pem" 159 try /bin/sh -c "cat out/A.pem out/A.key out/B.pem out/C.pem > out/A-chain.pem"
149 try /bin/sh -c "cat out/D.pem out/D.key out/E.pem out/C.pem > out/D-chain.pem" 160 try /bin/sh -c "cat out/D.pem out/D.key out/E.pem out/C.pem > out/D-chain.pem"
161 try /bin/sh -c "cat out/F.pem out/F.key out/E.pem out/C.pem > out/F-chain.pem"
150 162
151 try openssl pkcs12 \ 163 try openssl pkcs12 \
152 -in out/A-chain.pem \ 164 -in out/A-chain.pem \
153 -out client_1.p12 \ 165 -out client_1.p12 \
154 -export \ 166 -export \
155 -passout pass:chrome 167 -passout pass:chrome
156 168
157 try openssl pkcs12 \ 169 try openssl pkcs12 \
158 -in out/D-chain.pem \ 170 -in out/D-chain.pem \
159 -out client_2.p12 \ 171 -out client_2.p12 \
160 -export \ 172 -export \
161 -passout pass:chrome 173 -passout pass:chrome
162 174
175 try openssl pkcs12 \
176 -in out/F-chain.pem \
177 -out client_3.p12 \
178 -export \
179 -passout pass:chrome
180
163 echo Package the client certs for unit tests 181 echo Package the client certs for unit tests
164 try cp out/A.pem ../certificates/client_1.pem 182 try cp out/A.pem ../certificates/client_1.pem
165 try cp out/A.key ../certificates/client_1.key 183 try cp out/A.key ../certificates/client_1.key
166 try cp out/A.pk8 ../certificates/client_1.pk8 184 try cp out/A.pk8 ../certificates/client_1.pk8
167 try cp out/B.pem ../certificates/client_1_ca.pem 185 try cp out/B.pem ../certificates/client_1_ca.pem
168 186
169 try cp out/D.pem ../certificates/client_2.pem 187 try cp out/D.pem ../certificates/client_2.pem
170 try cp out/D.key ../certificates/client_2.key 188 try cp out/D.key ../certificates/client_2.key
171 try cp out/D.pk8 ../certificates/client_2.pk8 189 try cp out/D.pk8 ../certificates/client_2.pk8
172 try cp out/E.pem ../certificates/client_2_ca.pem 190 try cp out/E.pem ../certificates/client_2_ca.pem
191
192 try cp out/F.pem ../certificates/client_3.pem
193 try cp out/F.key ../certificates/client_3.key
194 try cp out/F.pk8 ../certificates/client_3.pk8
195 try cp out/E.pem ../certificates/client_3_ca.pem
OLDNEW
« no previous file with comments | « net/data/ssl/scripts/client-certs.cnf ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698