-
Notifications
You must be signed in to change notification settings - Fork 171
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
Fix test_pkey_dsa.rb in FIPS. #729
Conversation
Thanks for working on it!
This is #643. The traditional encrypted format can't work in FIPS mode due to MD5 being used internally, so it should be simply skipped.
Sorry, I didn't document how I crafted it and don't remember now. However, I think a better option is to take values from NIST CAVP test vectors (FIPS 186-4 for 2048-bit DSA): https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/digital-signatures |
07c83ed
to
82f41a2
Compare
Ah, right! Thanks for reminding this. I forgot what we dealt with this in the past, commenting the text below. Lines 145 to 150 in 043c503
I was not able to find the values from NIST CAVP test vectors on the linked document above. Could you tell me the details of how to get the values on the page? However, I was able to create the signature text, by checking this document - DSA signature with openssl dsa. And the openssl/test/openssl/test_pkey_dsa.rb Lines 61 to 64 in 043c503
Al the steps were executed by I rebased on the latest master branch, and also updated the commit message. |
Note that I created the `dsa2048.pem` and signature text (`signature_encoded.txt`), that is used as a text to create the `signature0` in the `test_sign_verify` by the following steps with the `openssl` CLI on FIPS module. ``` $ OPENSSL_DIR="${HOME}/.local/openssl-3.3.0-dev-fips-debug-1f03d33ef5" $ export OPENSSL_CONF="${OPENSSL_DIR}/ssl/openssl_fips.cnf" $ "${OPENSSL_DIR}/bin/openssl" dsaparam -out dsaparam2048.pem 2048 $ "${OPENSSL_DIR}/bin/openssl" gendsa -out dsa2048.pem dsaparam2048.pem $ echo -n "Sign me!" > data.txt $ "${OPENSSL_DIR}/bin/openssl" dgst -sha256 -sign dsa2048.pem data.txt > signature.txt $ cat signature.txt | base64 > signature_encoded.txt ``` Skip the `test_DSAPrivateKey_encrypted` on FIPS because AES-128-CBC, the password based encryption used in the PEM format uses MD5 for deriving the encryption key from the password, and MD5 is not FIPS-approved. See also the comment on the `test/openssl/utils.rb#omit_on_fips`.
82f41a2
to
4bdcb41
Compare
There are download links for .zip files at the bottom of the page. This is completely optional and the current changes look good to me. Thanks! |
As always, thanks for reviewing the PR! |
I missed to reply your comment above. I downloaded the And I extracted the zip file.
I checked the
Then I could see a list of the data set. Maybe this was the file, right? In this case, with the SHA-256, and DSA2048 in the
|
This PR is working in progress.So, I created the new file
test/openssl/fixtures/pkey/dsa2048.pem
by openssl CLI on the FIPS just in case. I referred to this document - Create a DSA Private Key with PEM format for the steps.There are still a failure and an error on the
test/openssl/test_pkey_dsa.rb
below with this PR. And I am not sure how to fix the issues. So, I want to ask @rhenium questions.For the
test_DSAPrivateKey_encrypted
, maybe I need to replace the following testing DSA private key with AES-128-CBC to another one. But I don't know how to create it maybe by openssl CLI command. How to create it?openssl/test/openssl/test_pkey_dsa.rb
Lines 133 to 143 in 1e8e246
For the
test_sign_verify
, I need to replace the following signature text to another one. But I don't know how to create it maybe by openssl CLI command. How to create it?openssl/test/openssl/test_pkey_dsa.rb
Lines 62 to 63 in 1e8e246