-
Notifications
You must be signed in to change notification settings - Fork 10
Add mock test cert generation #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
359b5dc to
57c3c4b
Compare
|
DDvO
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
Yet various small improvements.
|
|
||
| # This script generates the certificates needed for the CMP server and the signer | ||
|
|
||
| if [[ ! -f $mkcert_sh ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a concrete use case for setting mkcert_sh externally?
Otherwise I suggest dropping the guard.
| # sever certificate algorithms | ||
| if [ -z "$server_rootca_keyalg" ]; then | ||
| server_rootca_keyalg="MLDSA65" | ||
| fi | ||
| if [ -z "$server_leaf_keyalg" ]; then | ||
| server_leaf_keyalg="SLH-DSA-SHAKE-192s" | ||
| fi | ||
| # rootCACert update test case | ||
| if [ -z "$new_rootca_keyalg" ]; then | ||
| new_rootca_keyalg="SLH-DSA-SHAKE-192s" | ||
| fi | ||
|
|
||
| # End-entity certificate algorithms | ||
| if [ -z "$signer_rootca_keyalg" ]; then | ||
| signer_rootca_keyalg="MLDSA65" | ||
| fi | ||
| if [ -z "$signer_interca_keyalg" ]; then | ||
| signer_interca_keyalg="MLDSA65" | ||
| fi | ||
| if [ -z "$signer_subinterca_keyalg" ]; then | ||
| signer_subinterca_keyalg="MLDSA65" | ||
| fi | ||
| if [ -z "$signer_leaf_keyalg" ]; then | ||
| signer_leaf_keyalg="SLH-DSA-SHAKE-192s" | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please introduce and use a couple of script parameters, such that the script can be called
- for updating the hitherto test credentials with the same classical algorithms as before (RSA)
- for the given PQ tests with
MLDSA65andSLH-DSA-SHAKE-192s - for further ones, like KEM
|
|
||
| remove_serverfiles() { | ||
| echo "Removing server files" | ||
| rm -f server.key server-crt trusted.crt server_root.crt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in a file name, and better use same order as above:
| rm -f server.key server-crt trusted.crt server_root.crt | |
| rm -f server_root.crt trusted.crt server.key server.crt |
|
|
||
| gen_servercert() { | ||
| remove_serverfiles | ||
| sleep 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why sleep? Please comment or remove.
| fi | ||
|
|
||
| gen_demoCAfolder | ||
| openssl ca -gencrl -keyfile signer_subinterCA-key.pem -cert signer_subinterCA-cert.pem -out signer_subinterCA-crl.pem -crldays 36525 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use $DAYS after adding early in the script:
if [ -z "$DAYS" ]; then
DAYS=36524 # 100 years, with 24 leap years per 100 years until 2400
fi
BTW, the 36525 in mkcert.sh typically means 1 day more than 100 years
because a leap year occurs every 4 years, but not every 100 years, but still every 400 years (i.e., in 2000, in 2400, ...)
| "database = ./demoCA/index.txt" "crlnumber = ./demoCA/crlnumber" "default_md = default") | ||
| cat signer_leaf-cert.pem signer_subinterCA-cert.pem signer_interCA-cert.pem > signer_chain.pem | ||
| cat signer_subinterCA-cert.pem signer_interCA-cert.pem signer_root-cert.pem > signer_fullchain.pem | ||
| openssl pkcs12 -export -out signer.p12 -inkey signer_leaf-key.pem -in signer_leaf-cert.pem -certfile signer_fullchain.pem -password pass:12345 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| openssl pkcs12 -export -out signer.p12 -inkey signer_leaf-key.pem -in signer_leaf-cert.pem -certfile signer_fullchain.pem -password pass:12345 | |
| openssl pkcs12 -export -out signer.p12 -inkey signer_leaf-key.pem -in signer_leaf-cert.pem -certfile signer_fullchain.pem -password file:12345.txt |
| openssl pkey -in new.key -out new_pass_12345.key -aes256 -passout pass:12345 | ||
| echo "12345" > 12345.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| openssl pkey -in new.key -out new_pass_12345.key -aes256 -passout pass:12345 | |
| echo "12345" > 12345.txt | |
| openssl pkey -in new.key -out new_pass_12345.key -aes256 -passout file:12345.txt |
| new_rootca_keyalg="SLH-DSA-SHAKE-192s" | ||
| fi | ||
|
|
||
| # End-entity certificate algorithms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # End-entity certificate algorithms | |
| # algorithms for client certificate chain |
| gen_servercert | ||
| gen_signercert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| gen_servercert | |
| gen_signercert | |
| gen_server_chain | |
| gen_client_chain |
| @@ -0,0 +1,417 @@ | |||
| #! /bin/bash | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mark in the file the part(s) adapted, or was an unchanged copy sufficient?
| openssl pkey -in new.key -out new_pass_12345.key -aes256 -passout pass:12345 | ||
| echo "12345" > 12345.txt | ||
| cp new.key signer.key | ||
| mv signer_leaf-cert.pem signer_only.crt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a further signer cert with NULL-DN subject and without a subjectKeyIdentifier,
which will be needed in a new test case on senderKID.
If there is no simple way of using for this case mkcert_sh genee, you can also use:
openssl x509 -new -subj "/" -days $DAYS -extfile <(printf "subjectKeyIdentifier=none") -out signer_no_SKID.crt -key signer.key
|
Please also add a run of |
setup-Mock.sh: add files for rootCaCert test setup-mock.sh: option to set variables from cli
OpenSSL_versions.yaml: add test_Mock for OpenSSL-3.5 with PQ algorithms Update OpenSSL_versions.yml Update OpenSSL_versions.yml
57c3c4b to
ba840da
Compare
|



Motivation
Script to generate Mock certificates and keys for testing.
Added OpenSSL-3.5 test to CI test.
Added Mock test with PQ algorithm (MLDSA & SLH-DSA) using OpenSSL-3.5.