xref: /freebsd/crypto/openssl/test/certs/setup.sh (revision 783d3ff6d7fae619db8a7990b8a6387de0c677b5)
1#! /bin/bash
2
3# Primary root: root-cert
4./mkcert.sh genroot "Root CA" root-key root-cert
5# root cert variants: CA:false, key2, DN2, expired
6./mkcert.sh genss "Root CA" root-key root-nonca
7./mkcert.sh genroot "Root CA" root-key2 root-cert2
8./mkcert.sh genroot "Root Cert 2" root-key root-name2
9DAYS=-1 ./mkcert.sh genroot "Root CA" root-key root-expired
10# cross root and root cross cert
11./mkcert.sh genroot "Cross Root" cross-key cross-root
12./mkcert.sh genca "Root CA" root-key root-cross-cert cross-key cross-root
13# trust variants: +serverAuth -serverAuth +clientAuth -clientAuth
14openssl x509 -in root-cert.pem -trustout \
15    -addtrust serverAuth -out root+serverAuth.pem
16openssl x509 -in root-cert.pem -trustout \
17    -addreject serverAuth -out root-serverAuth.pem
18openssl x509 -in root-cert.pem -trustout \
19    -addtrust clientAuth -out root+clientAuth.pem
20openssl x509 -in root-cert.pem -trustout \
21    -addreject clientAuth -out root-clientAuth.pem
22# trust variants: +anyEKU -anyEKU
23openssl x509 -in root-cert.pem -trustout \
24    -addtrust anyExtendedKeyUsage -out root+anyEKU.pem
25openssl x509 -in root-cert.pem -trustout \
26    -addreject anyExtendedKeyUsage -out root-anyEKU.pem
27# root-cert2 trust variants: +serverAuth -serverAuth +clientAuth
28openssl x509 -in root-cert2.pem -trustout \
29    -addtrust serverAuth -out root2+serverAuth.pem
30openssl x509 -in root-cert2.pem -trustout \
31    -addreject serverAuth -out root2-serverAuth.pem
32openssl x509 -in root-cert2.pem -trustout \
33    -addtrust clientAuth -out root2+clientAuth.pem
34# root-nonca trust variants: +serverAuth +anyEKU
35openssl x509 -in root-nonca.pem -trustout \
36    -addtrust serverAuth -out nroot+serverAuth.pem
37openssl x509 -in root-nonca.pem -trustout \
38    -addtrust anyExtendedKeyUsage -out nroot+anyEKU.pem
39
40# Root CA security level variants:
41# MD5 self-signature
42OPENSSL_SIGALG=md5 \
43./mkcert.sh genroot "Root CA" root-key root-cert-md5
44# 768-bit key
45OPENSSL_KEYBITS=768 \
46./mkcert.sh genroot "Root CA" root-key-768 root-cert-768
47
48# primary client-EKU root: croot-cert
49./mkcert.sh genroot "Root CA" root-key croot-cert clientAuth
50# trust variants: +serverAuth -serverAuth +clientAuth -clientAuth +anyEKU -anyEKU
51openssl x509 -in croot-cert.pem -trustout \
52    -addtrust serverAuth -out croot+serverAuth.pem
53openssl x509 -in croot-cert.pem -trustout \
54    -addreject serverAuth -out croot-serverAuth.pem
55openssl x509 -in croot-cert.pem -trustout \
56    -addtrust clientAuth -out croot+clientAuth.pem
57openssl x509 -in croot-cert.pem -trustout \
58    -addreject clientAuth -out croot-clientAuth.pem
59openssl x509 -in croot-cert.pem -trustout \
60    -addtrust anyExtendedKeyUsage -out croot+anyEKU.pem
61openssl x509 -in croot-cert.pem -trustout \
62    -addreject anyExtendedKeyUsage -out croot-anyEKU.pem
63
64# primary server-EKU root: sroot-cert
65./mkcert.sh genroot "Root CA" root-key sroot-cert serverAuth
66# trust variants: +serverAuth -serverAuth +clientAuth -clientAuth +anyEKU -anyEKU
67openssl x509 -in sroot-cert.pem -trustout \
68    -addtrust serverAuth -out sroot+serverAuth.pem
69openssl x509 -in sroot-cert.pem -trustout \
70    -addreject serverAuth -out sroot-serverAuth.pem
71openssl x509 -in sroot-cert.pem -trustout \
72    -addtrust clientAuth -out sroot+clientAuth.pem
73openssl x509 -in sroot-cert.pem -trustout \
74    -addreject clientAuth -out sroot-clientAuth.pem
75openssl x509 -in sroot-cert.pem -trustout \
76    -addtrust anyExtendedKeyUsage -out sroot+anyEKU.pem
77openssl x509 -in sroot-cert.pem -trustout \
78    -addreject anyExtendedKeyUsage -out sroot-anyEKU.pem
79
80# Primary intermediate ca: ca-cert
81./mkcert.sh genca "CA" ca-key ca-cert root-key root-cert
82# ca variants: CA:false, no bc, key2, DN2, issuer2, expired
83./mkcert.sh genee "CA" ca-key ca-nonca root-key root-cert
84./mkcert.sh gen_nonbc_ca "CA" ca-key ca-nonbc root-key root-cert
85./mkcert.sh genca "CA" ca-key2 ca-cert2 root-key root-cert
86./mkcert.sh genca "CA2" ca-key ca-name2 root-key root-cert
87./mkcert.sh genca "CA" ca-key ca-root2 root-key2 root-cert2
88DAYS=-1 ./mkcert.sh genca "CA" ca-key ca-expired root-key root-cert
89# trust variants: +serverAuth, -serverAuth, +clientAuth, -clientAuth
90openssl x509 -in ca-cert.pem -trustout \
91    -addtrust serverAuth -out ca+serverAuth.pem
92openssl x509 -in ca-cert.pem -trustout \
93    -addreject serverAuth -out ca-serverAuth.pem
94openssl x509 -in ca-cert.pem -trustout \
95    -addtrust clientAuth -out ca+clientAuth.pem
96openssl x509 -in ca-cert.pem -trustout \
97    -addreject clientAuth -out ca-clientAuth.pem
98# trust variants: +anyEKU, -anyEKU
99openssl x509 -in ca-cert.pem -trustout \
100    -addtrust anyExtendedKeyUsage -out ca+anyEKU.pem
101openssl x509 -in ca-cert.pem -trustout \
102    -addreject anyExtendedKeyUsage -out ca-anyEKU.pem
103# ca-nonca trust variants: +serverAuth, +anyEKU
104openssl x509 -in ca-nonca.pem -trustout \
105    -addtrust serverAuth -out nca+serverAuth.pem
106openssl x509 -in ca-nonca.pem -trustout \
107    -addtrust anyExtendedKeyUsage -out nca+anyEKU.pem
108
109# Intermediate CA security variants:
110# MD5 issuer signature,
111OPENSSL_SIGALG=md5 \
112./mkcert.sh genca "CA" ca-key ca-cert-md5 root-key root-cert
113openssl x509 -in ca-cert-md5.pem -trustout \
114    -addtrust anyExtendedKeyUsage -out ca-cert-md5-any.pem
115# Issuer has 768-bit key
116./mkcert.sh genca "CA" ca-key ca-cert-768i root-key-768 root-cert-768
117# CA has 768-bit key
118OPENSSL_KEYBITS=768 \
119./mkcert.sh genca "CA" ca-key-768 ca-cert-768 root-key root-cert
120# EC cert with explicit curve
121./mkcert.sh genca "CA" ca-key-ec-explicit ca-cert-ec-explicit root-key root-cert
122# EC cert with named curve
123./mkcert.sh genca "CA" ca-key-ec-named ca-cert-ec-named root-key root-cert
124
125# client intermediate ca: cca-cert
126./mkcert.sh genca -p clientAuth "CA" ca-key cca-cert root-key root-cert
127# trust variants: +serverAuth, -serverAuth, +clientAuth, -clientAuth, +anyEKU, -anyEKU
128openssl x509 -in cca-cert.pem -trustout \
129    -addtrust serverAuth -out cca+serverAuth.pem
130openssl x509 -in cca-cert.pem -trustout \
131    -addreject serverAuth -out cca-serverAuth.pem
132openssl x509 -in cca-cert.pem -trustout \
133    -addtrust clientAuth -out cca+clientAuth.pem
134openssl x509 -in cca-cert.pem -trustout \
135    -addreject clientAuth -out cca-clientAuth.pem
136openssl x509 -in cca-cert.pem -trustout \
137    -addtrust anyExtendedKeyUsage -out cca+anyEKU.pem
138openssl x509 -in cca-cert.pem -trustout \
139    -addreject anyExtendedKeyUsage -out cca-anyEKU.pem
140
141# server intermediate ca: sca-cert
142./mkcert.sh genca -p serverAuth "CA" ca-key sca-cert root-key root-cert
143# trust variants: +serverAuth, -serverAuth, +clientAuth, -clientAuth, +anyEKU, -anyEKU
144openssl x509 -in sca-cert.pem -trustout \
145    -addtrust serverAuth -out sca+serverAuth.pem
146openssl x509 -in sca-cert.pem -trustout \
147    -addreject serverAuth -out sca-serverAuth.pem
148openssl x509 -in sca-cert.pem -trustout \
149    -addtrust clientAuth -out sca+clientAuth.pem
150openssl x509 -in sca-cert.pem -trustout \
151    -addreject clientAuth -out sca-clientAuth.pem
152openssl x509 -in sca-cert.pem -trustout \
153    -addtrust anyExtendedKeyUsage -out sca+anyEKU.pem
154openssl x509 -in sca-cert.pem -trustout \
155    -addreject anyExtendedKeyUsage -out sca-anyEKU.pem
156
157# Primary leaf cert: ee-cert with default purpose: serverAuth
158./mkcert.sh genee server.example ee-key ee-cert ca-key ca-cert
159# ee variants: expired, issuer-key2, issuer-name2, bad-pathlen
160./mkcert.sh genee server.example ee-key ee-expired ca-key ca-cert -days -1
161./mkcert.sh genee server.example ee-key ee-cert2 ca-key2 ca-cert2
162./mkcert.sh genee server.example ee-key ee-name2 ca-key ca-name2
163./mkcert.sh genee server.example ee-key ee-pathlen ca-key ca-cert \
164    -extfile <(echo "basicConstraints=CA:false,pathlen:0") # bash needed here
165# purpose variants: clientAuth
166./mkcert.sh genee -p clientAuth server.example ee-key ee-client ca-key ca-cert
167# trust variants: +serverAuth, -serverAuth, +clientAuth, -clientAuth
168openssl x509 -in ee-cert.pem -trustout \
169    -addtrust serverAuth -out ee+serverAuth.pem
170openssl x509 -in ee-cert.pem -trustout \
171    -addreject serverAuth -out ee-serverAuth.pem
172openssl x509 -in ee-client.pem -trustout \
173    -addtrust clientAuth -out ee+clientAuth.pem
174openssl x509 -in ee-client.pem -trustout \
175    -addreject clientAuth -out ee-clientAuth.pem
176
177# Leaf cert security level variants
178# MD5 issuer signature
179OPENSSL_SIGALG=md5 \
180./mkcert.sh genee server.example ee-key ee-cert-md5 ca-key ca-cert
181# 768-bit issuer key
182./mkcert.sh genee server.example ee-key ee-cert-768i ca-key-768 ca-cert-768
183# 768-bit leaf key
184OPENSSL_KEYBITS=768 \
185./mkcert.sh genee server.example ee-key-768 ee-cert-768 ca-key ca-cert
186# EC cert with explicit curve signed by named curve ca
187./mkcert.sh genee server.example ee-key-ec-explicit ee-cert-ec-explicit ca-key-ec-named ca-cert-ec-named
188# EC cert with named curve signed by explicit curve ca
189./mkcert.sh genee server.example ee-key-ec-named-explicit \
190    ee-cert-ec-named-explicit ca-key-ec-explicit ca-cert-ec-explicit
191# EC cert with named curve signed by named curve ca
192./mkcert.sh genee server.example ee-key-ec-named-named \
193    ee-cert-ec-named-named ca-key-ec-named ca-cert-ec-named
194# 1024-bit leaf key
195OPENSSL_KEYBITS=1024 \
196./mkcert.sh genee server.example ee-key-1024 ee-cert-1024 ca-key ca-cert
197# 3072-bit leaf key
198OPENSSL_KEYBITS=3072 \
199./mkcert.sh genee server.example ee-key-3072 ee-cert-3072 ca-key ca-cert
200# 4096-bit leaf key
201OPENSSL_KEYBITS=4096 \
202./mkcert.sh genee server.example ee-key-4096 ee-cert-4096 ca-key ca-cert
203# 8192-bit leaf key
204OPENSSL_KEYBITS=8192 \
205./mkcert.sh genee server.example ee-key-8192 ee-cert-8192 ca-key ca-cert
206
207# self-signed end-entity cert with explicit keyUsage not including KeyCertSign
208openssl req -new -x509 -key ee-key.pem -subj /CN=ee-self-signed -out ee-self-signed.pem -addext keyUsage=digitalSignature -days 36525
209
210# Proxy certificates, off of ee-client
211# Start with some good ones
212./mkcert.sh req pc1-key "0.CN = server.example" "1.CN = proxy 1" | \
213    ./mkcert.sh genpc pc1-key pc1-cert ee-key ee-client \
214                "language = id-ppl-anyLanguage" "pathlen = 1" "policy = text:AB"
215./mkcert.sh req pc2-key "0.CN = server.example" "1.CN = proxy 1" "2.CN = proxy 2" | \
216    ./mkcert.sh genpc pc2-key pc2-cert pc1-key pc1-cert \
217                "language = id-ppl-anyLanguage" "pathlen = 0" "policy = text:AB"
218# And now a couple of bad ones
219# pc3: incorrect CN
220./mkcert.sh req bad-pc3-key "0.CN = server.example" "1.CN = proxy 3" | \
221    ./mkcert.sh genpc bad-pc3-key bad-pc3-cert pc1-key pc1-cert \
222                "language = id-ppl-anyLanguage" "pathlen = 0" "policy = text:AB"
223# pc4: incorrect pathlen
224./mkcert.sh req bad-pc4-key "0.CN = server.example" "1.CN = proxy 1" "2.CN = proxy 4" | \
225    ./mkcert.sh genpc bad-pc4-key bad-pc4-cert pc1-key pc1-cert \
226                "language = id-ppl-anyLanguage" "pathlen = 1" "policy = text:AB"
227# pc5: no policy
228./mkcert.sh req pc5-key "0.CN = server.example" "1.CN = proxy 1" "2.CN = proxy 5" | \
229    ./mkcert.sh genpc pc5-key pc5-cert pc1-key pc1-cert \
230                "language = id-ppl-anyLanguage" "pathlen = 0"
231# pc6: incorrect CN (made into a component of a multivalue RDN)
232./mkcert.sh req bad-pc6-key "0.CN = server.example" "1.CN = proxy 1" "2.+CN = proxy 6" | \
233    ./mkcert.sh genpc bad-pc6-key bad-pc6-cert pc1-key pc1-cert \
234                "language = id-ppl-anyLanguage" "pathlen = 0" "policy = text:AB"
235
236# Name constraints test certificates.
237
238# NC CA1 only permits the host www.good.org and *.good.com email address
239# good@good.org and *@good.com and IP addresses 127.0.0.1 and
240# 192.168.0.0/16
241
242NC="permitted;DNS:www.good.org, permitted;DNS:good.com,"
243NC="$NC permitted;email:good@good.org, permitted;email:good.com,"
244NC="$NC permitted;IP:127.0.0.1/255.255.255.255, permitted;IP:192.168.0.0/255.255.0.0"
245
246NC=$NC ./mkcert.sh genca "Test NC CA 1" ncca1-key ncca1-cert root-key root-cert
247
248# NC CA2 allows anything apart from hosts www.bad.org and *.bad.com
249# and email addresses bad@bad.org and *@bad.com
250
251NC="excluded;DNS:www.bad.org, excluded;DNS:bad.com,"
252NC="$NC excluded;email:bad@bad.org, excluded;email:bad.com, "
253NC="$NC excluded;IP:10.0.0.0/255.0.0.0"
254
255NC=$NC ./mkcert.sh genca "Test NC CA 2" ncca2-key ncca2-cert root-key root-cert
256
257# Name constraints subordinate CA. Adds www.good.net (which should be
258# disallowed because parent CA doesn't permit it) adds ok.good.com
259# (which should be allowed because parent allows *.good.com
260# and now excludes bad.ok.good.com (allowed in permitted subtrees
261# but explicitly excluded).
262
263NC="permitted;DNS:www.good.net, permitted;DNS:ok.good.com, "
264NC="$NC excluded;DNS:bad.ok.good.com"
265NC=$NC ./mkcert.sh genca "Test NC sub CA" ncca3-key ncca3-cert \
266        ncca1-key ncca1-cert
267
268# all subjectAltNames allowed by CA1.  Some CNs are not!
269
270./mkcert.sh req alt1-key "O = Good NC Test Certificate 1" \
271    "1.CN=www.example.net" "2.CN=Joe Bloggs" | \
272    ./mkcert.sh geneealt alt1-key alt1-cert ncca1-key ncca1-cert \
273    "DNS.1 = www.good.org" "DNS.2 = any.good.com" \
274    "email.1 = good@good.org" "email.2 = any@good.com" \
275    "IP = 127.0.0.1" "IP = 192.168.0.1"
276
277# all DNS-like CNs allowed by CA1, no DNS SANs.
278
279./mkcert.sh req goodcn1-key "O = Good NC Test Certificate 1" \
280    "1.CN=www.good.org" "2.CN=any.good.com" \
281    "3.CN=not..dns" "4.CN=not@dns" "5.CN=not-.dns" "6.CN=not.dns." | \
282    ./mkcert.sh geneealt goodcn1-key goodcn1-cert ncca1-key ncca1-cert \
283    "IP = 127.0.0.1" "IP = 192.168.0.1"
284
285# all DNS-like CNs allowed by CA1, no SANs
286
287./mkcert.sh req goodcn2-key "O = Good NC Test Certificate 1" \
288    "CN=www.good.org" | \
289    ./mkcert.sh geneeconfig goodcn2-key goodcn2-cert ncca1-key ncca1-cert
290
291# Some DNS-like CNs not permitted by CA1, no DNS SANs.
292
293./mkcert.sh req badcn1-key "O = Good NC Test Certificate 1" \
294    "1.CN=www.good.org" "3.CN=bad.net" | \
295    ./mkcert.sh geneealt badcn1-key badcn1-cert ncca1-key ncca1-cert \
296    "IP = 127.0.0.1" "IP = 192.168.0.1"
297
298# no subjectAltNames excluded by CA2.
299
300./mkcert.sh req alt2-key "O = Good NC Test Certificate 2" | \
301    ./mkcert.sh geneealt alt2-key alt2-cert ncca2-key ncca2-cert \
302    "DNS.1 = www.anything.org" "DNS.2 = any.other.com" \
303    "email.1 = other@bad.org" "email.2 = any@something.com"
304
305# hostname other.good.org which is not allowed by CA1.
306
307./mkcert.sh req badalt1-key "O = Bad NC Test Certificate 1" | \
308    ./mkcert.sh geneealt badalt1-key badalt1-cert ncca1-key ncca1-cert \
309    "DNS.1 = other.good.org" "DNS.2 = any.good.com" \
310    "email.1 = good@good.org" "email.2 = any@good.com"
311
312# any.bad.com is excluded by CA2.
313
314./mkcert.sh req badalt2-key 'O = Bad NC Test Certificate 2' | \
315    ./mkcert.sh geneealt badalt2-key badalt2-cert ncca2-key ncca2-cert \
316    "DNS.1 = www.good.org" "DNS.2 = any.bad.com" \
317    "email.1 = good@good.org" "email.2 = any@good.com"
318
319# other@good.org not permitted by CA1
320
321./mkcert.sh req badalt3-key "O = Bad NC Test Certificate 3" | \
322    ./mkcert.sh geneealt badalt3-key badalt1-cert ncca1-key ncca1-cert \
323    "DNS.1 = www.good.org" "DNS.2 = any.good.com" \
324    "email.1 = other@good.org" "email.2 = any@good.com"
325
326# all subject alt names OK but subject email address not allowed by CA1.
327
328./mkcert.sh req badalt4-key 'O = Bad NC Test Certificate 4' \
329    "emailAddress = any@other.com" | \
330    ./mkcert.sh geneealt badalt4-key badalt4-cert ncca1-key ncca1-cert \
331    "DNS.1 = www.good.org" "DNS.2 = any.good.com" \
332    "email.1 = good@good.org" "email.2 = any@good.com"
333
334# IP address not allowed by CA1
335./mkcert.sh req badalt5-key "O = Bad NC Test Certificate 5" | \
336    ./mkcert.sh geneealt badalt5-key badalt5-cert ncca1-key ncca1-cert \
337    "DNS.1 = www.good.org" "DNS.2 = any.good.com" \
338    "email.1 = good@good.org" "email.2 = any@good.com" \
339    "IP = 127.0.0.2"
340
341# No DNS-ID SANs and subject CN not allowed by CA1.
342./mkcert.sh req badalt6-key "O = Bad NC Test Certificate 6" \
343    "1.CN=other.good.org" "2.CN=Joe Bloggs" "3.CN=any.good.com" | \
344    ./mkcert.sh geneealt badalt6-key badalt6-cert ncca1-key ncca1-cert \
345    "email.1 = good@good.org" "email.2 = any@good.com" \
346    "IP = 127.0.0.1" "IP = 192.168.0.1"
347
348# No DNS-ID SANS and subject CN not allowed by CA1, BMPSTRING
349REQMASK=MASK:0x800 ./mkcert.sh req badalt7-key "O = Bad NC Test Certificate 7" \
350    "1.CN=other.good.org" "2.CN=Joe Bloggs" "3.CN=any.good.com" | \
351    ./mkcert.sh geneealt badalt7-key badalt7-cert ncca1-key ncca1-cert \
352    "email.1 = good@good.org" "email.2 = any@good.com" \
353    "IP = 127.0.0.1" "IP = 192.168.0.1"
354
355# all subjectAltNames allowed by chain
356
357./mkcert.sh req alt3-key "O = Good NC Test Certificate 3" \
358    "1.CN=www.ok.good.com" "2.CN=Joe Bloggs" | \
359    ./mkcert.sh geneealt alt3-key alt3-cert ncca3-key ncca3-cert \
360    "DNS.1 = www.ok.good.com" \
361    "email.1 = good@good.org" "email.2 = any@good.com" \
362    "IP = 127.0.0.1" "IP = 192.168.0.1"
363
364# www.good.net allowed by parent CA but not parent of parent
365
366./mkcert.sh req badalt8-key "O = Bad NC Test Certificate 8" \
367    "1.CN=www.good.com" "2.CN=Joe Bloggs" | \
368    ./mkcert.sh geneealt badalt8-key badalt8-cert ncca3-key ncca3-cert \
369    "DNS.1 = www.ok.good.com" "DNS.2 = www.good.net" \
370    "email.1 = good@good.org" "email.2 = any@good.com" \
371    "IP = 127.0.0.1" "IP = 192.168.0.1"
372
373# other.good.com not allowed by parent CA but allowed by parent of parent
374
375./mkcert.sh req badalt9-key "O = Bad NC Test Certificate 9" \
376    "1.CN=www.good.com" "2.CN=Joe Bloggs" | \
377    ./mkcert.sh geneealt badalt9-key badalt9-cert ncca3-key ncca3-cert \
378    "DNS.1 = www.good.com" "DNS.2 = other.good.com" \
379    "email.1 = good@good.org" "email.2 = any@good.com" \
380    "IP = 127.0.0.1" "IP = 192.168.0.1"
381
382# www.bad.net excluded by parent CA.
383
384./mkcert.sh req badalt10-key "O = Bad NC Test Certificate 10" \
385    "1.CN=www.ok.good.com" "2.CN=Joe Bloggs" | \
386    ./mkcert.sh geneealt badalt10-key badalt10-cert ncca3-key ncca3-cert \
387    "DNS.1 = www.ok.good.com" "DNS.2 = bad.ok.good.com" \
388    "email.1 = good@good.org" "email.2 = any@good.com" \
389    "IP = 127.0.0.1" "IP = 192.168.0.1"
390
391# Certs for CVE-2022-4203 testcase
392
393NC="excluded;otherName:SRVName;UTF8STRING:foo@example.org" ./mkcert.sh genca \
394    "Test NC CA othername" nccaothername-key nccaothername-cert \
395    root-key root-cert
396
397./mkcert.sh req alt-email-key "O = NC email in othername Test Certificate" | \
398    ./mkcert.sh geneealt bad-othername-key bad-othername-cert \
399    nccaothername-key nccaothername-cert \
400    "otherName.1 = SRVName;UTF8STRING:foo@example.org"
401
402# RSA-PSS signatures
403# SHA1
404./mkcert.sh genee PSS-SHA1 ee-key ee-pss-sha1-cert ca-key ca-cert \
405    -sha1 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:digest
406# EE SHA256
407./mkcert.sh genee PSS-SHA256 ee-key ee-pss-sha256-cert ca-key ca-cert \
408            -sha256 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:digest
409# CA-PSS
410./mkcert.sh genca "CA-PSS" ca-pss-key ca-pss-cert root-key root-cert \
411            -sha256 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1
412./mkcert.sh genee "EE-PSS" ee-key ee-pss-cert ca-pss-key ca-pss-cert \
413            -sha256 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1
414# Should not have been possible to produce, see issue #13968:
415#./mkcert.sh genee "EE-PSS-wrong1.5" ee-key ee-pss-wrong1.5-cert ca-pss-key ca-pss-cert -sha256
416
417OPENSSL_KEYALG=ec OPENSSL_KEYBITS=brainpoolP256r1 ./mkcert.sh genee \
418    "Server ECDSA brainpoolP256r1 cert" server-ecdsa-brainpoolP256r1-key \
419    server-ecdsa-brainpoolP256r1-cert rootkey rootcert
420
421openssl req -new -noenc -subj "/CN=localhost" \
422    -newkey rsa-pss -keyout server-pss-restrict-key.pem \
423    -pkeyopt rsa_pss_keygen_md:sha256 -pkeyopt rsa_pss_keygen_saltlen:32 | \
424    ./mkcert.sh geneenocsr "Server RSA-PSS restricted cert" \
425    server-pss-restrict-cert rootkey rootcert
426
427# CT entry
428./mkcert.sh genct server.example embeddedSCTs1-key embeddedSCTs1 embeddedSCTs1_issuer-key embeddedSCTs1_issuer ct-server-key
429
430OPENSSL_SIGALG= OPENSSL_KEYALG=ed448 ./mkcert.sh genroot "Root Ed448" \
431    root-ed448-key root-ed448-cert
432OPENSSL_SIGALG=ED448 OPENSSL_KEYALG=ed448 ./mkcert.sh genee ed448 \
433    server-ed448-key server-ed448-cert root-ed448-key root-ed448-cert
434
435# non-critical unknown extension
436./mkcert.sh geneeextra server.example ee-key ee-cert-noncrit-unknown-ext ca-key ca-cert "1.2.3.4=DER:05:00"
437
438# critical unknown extension
439./mkcert.sh geneeextra server.example ee-key ee-cert-crit-unknown-ext ca-key ca-cert "1.2.3.4=critical,DER:05:00"
440
441# critical id-pkix-ocsp-no-check extension
442./mkcert.sh geneeextra server.example ee-key ee-cert-ocsp-nocheck ca-key ca-cert "1.3.6.1.5.5.7.48.1.5=critical,DER:05:00"
443
444# certificatePolicies extension
445./mkcert.sh genca -c "1.3.6.1.4.1.16604.998855.1" "CA" ca-key ca-pol-cert root-key root-cert
446./mkcert.sh geneeextra server.example ee-key ee-cert-policies ca-key ca-cert "certificatePolicies=1.3.6.1.4.1.16604.998855.1"
447# We can create a cert with a duplicate policy oid - but its actually invalid!
448./mkcert.sh geneeextra server.example ee-key ee-cert-policies-bad ca-key ca-cert "certificatePolicies=1.3.6.1.4.1.16604.998855.1,1.3.6.1.4.1.16604.998855.1"
449