文章目录
- openssl3.2/test/certs - 070 - Certs for CVE-2022-4203 testcase
- 概述
- 笔记
- END
openssl3.2/test/certs - 070 - Certs for CVE-2022-4203 testcase
概述
openssl3.2 - 官方demo学习 - test - certs
笔记
/*!
* \file D:\my_dev\my_local_git_prj\study\openSSL\test_certs\070\my_openssl_linux_doc_070.txt
* \note openssl3.2/test/certs - 070 - Certs for CVE-2022-4203 testcase
*/// --------------------------------------------------------------------------------
// official bash script
// --------------------------------------------------------------------------------
#! /bin/bash# \file setup070.sh# openssl3.2/test/certs - 070 - Certs for CVE-2022-4203 testcaseNC="excluded;otherName:SRVName;UTF8STRING:foo@example.org" ./mkcert.sh genca \"Test NC CA othername" nccaothername-key nccaothername-cert \root-key root-certopenssl -v./mkcert.sh req alt-email-key "O = NC email in othername Test Certificate" | \./mkcert.sh geneealt bad-othername-key bad-othername-cert \nccaothername-key nccaothername-cert \"otherName.1 = SRVName;UTF8STRING:foo@example.org"// --------------------------------------------------------------------------------
// openssl cmd line parse
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// bash line 1// bash line1 - cmd 1
openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:2048 -out nccaothername-key.pem // bash line1 - cmd 2
// cfg_exp070_sc1_cmd2.txt
string_mask=utf8only
[req]
prompt = no
distinguished_name = dn
[dn]
CN = Test NC CA othernameopenssl req -new -sha256 -key nccaothername-key.pem -config cfg_exp070_sc1_cmd2.txt -out req_exp070_sc1_cmd2.pem // bash line1 - cmd 3
// cfg_exp070_sc1_cmd3.txt
basicConstraints = critical,CA:true
keyUsage = keyCertSign,cRLSign
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid
nameConstraints = excluded;otherName:SRVName;UTF8STRING:foo@example.orgopenssl x509 -req -sha256 -out nccaothername-cert.pem -extfile cfg_exp070_sc1_cmd3.txt -CA root-cert.pem -CAkey root-key.pem -set_serial 2 -days 36525 -in req_exp070_sc1_cmd2.pem// --------------------------------------------------------------------------------
// bash line 2
// bash line1=2 - cmd 1
openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:2048 -out alt-email-key.pem // bash line1=2 - cmd 3
// cfg_exp070_sc2_cmd3.txt
string_mask=utf8only
[req]
prompt = no
distinguished_name = dn
[dn]
O = NC email in othername Test Certificateopenssl req -new -sha256 -key alt-email-key.pem -config cfg_exp070_sc2_cmd3.txt -out req_exp070_sc2_cmd3.pem// bash line1=2 - cmd 2
// cfg_exp070_sc2_cmd2.txt
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid
basicConstraints = CA:falsesubjectAltName = @alts
[alts]
otherName.1 = SRVName;UTF8STRING:foo@example.orgopenssl x509 -req -sha256 -out bad-othername-cert.pem -extfile cfg_exp070_sc2_cmd2.txt -CA nccaothername-cert.pem -CAkey nccaothername-key.pem -set_serial 2 -days 36525 -in req_exp070_sc2_cmd3.pem// --------------------------------------------------------------------------------
// openssl log
// --------------------------------------------------------------------------------openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:2048 -out nccaothername-key.pem
openssl req -new -sha256 -key nccaothername-key.pem -config /dev/fd/63 -config /dev/fd/63 => /home/lostspeed/openssl/openssl-3.2.0_debian/test/certs/my_openssl_linux_log.txtstring_mask=utf8only
[req]
prompt = no
distinguished_name = dn
[dn]
CN = Test NC CA othername
openssl x509 -req -sha256 -out nccaothername-cert.pem -extfile /dev/fd/63 -CA root-cert.pem -CAkey root-key.pem -set_serial 2 -days 36525 -extfile /dev/fd/63 => /home/lostspeed/openssl/openssl-3.2.0_debian/test/certs/my_openssl_linux_log.txtbasicConstraints = critical,CA:true
keyUsage = keyCertSign,cRLSign
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid
nameConstraints = excluded;otherName:SRVName;UTF8STRING:foo@example.org
openssl -v
openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:2048 -out alt-email-key.pem
openssl x509 -req -sha256 -out bad-othername-cert.pem -extfile /dev/fd/63 -CA nccaothername-cert.pem -CAkey nccaothername-key.pem -set_serial 2 -days 36525 -extfile /dev/fd/63 => /home/lostspeed/openssl/openssl-3.2.0_debian/test/certs/my_openssl_linux_log.txtsubjectKeyIdentifier = hash
authorityKeyIdentifier = keyid
basicConstraints = CA:falsesubjectAltName = @alts
[alts]
otherName.1 = SRVName;UTF8STRING:foo@example.org
openssl req -new -sha256 -key alt-email-key.pem -config /dev/fd/63 -config /dev/fd/63 => /home/lostspeed/openssl/openssl-3.2.0_debian/test/certs/my_openssl_linux_log.txtstring_mask=utf8only
[req]
prompt = no
distinguished_name = dn
[dn]
O = NC email in othername Test Certificate