setup.sh 19 KB

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