Fix RSA-PSS signature verification and key generation issues#156
Merged
rlm2002 merged 4 commits intowolfSSL:masterfrom Sep 15, 2025
Merged
Fix RSA-PSS signature verification and key generation issues#156rlm2002 merged 4 commits intowolfSSL:masterfrom
rlm2002 merged 4 commits intowolfSSL:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes several RSA-PSS signature verification and key generation issues in the wolfJCE provider to improve compatibility with OpenJDK SunJCE tests.
- Fixes
WolfCryptSignature.engineVerify()to use correct digest parameter inrsaPssVerifyWithDigest()method - Adds restriction for RSA private keys to require CRT parameters, similar to cipher implementation
- Implements dedicated RSASSA-PSS key pair generator with proper algorithm identification and system KeyFactory compatibility
- Corrects default SHA-256 salt length in PSS parameters
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| WolfCryptSignature.java | Fixes RSA-PSS signature verification logic and adds RSA private key validation |
| WolfCryptPssParameters.java | Updates default salt length to use SHA-256 digest size |
| WolfCryptProvider.java | Registers dedicated RSASSA-PSS key pair generator service |
| WolfCryptKeyPairGenerator.java | Implements RSASSA-PSS key generation with proper algorithm identification |
| WolfCryptSignatureTest.java | Adds comprehensive test for RSA-PSS multiple updates scenario |
| WolfCryptKeyPairGeneratorTest.java | Adds test for RSASSA-PSS key compatibility with system KeyFactory |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptSignatureTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/wolfssl/provider/jce/test/WolfCryptKeyPairGeneratorTest.java
Outdated
Show resolved
Hide resolved
…h OpenJDK KeyFactory
… similar to WolfCryptCipher. Give better exception to user in those cases.
…ineVerify() to pass digest instead of full data
a50125d to
9b49799
Compare
rlm2002
approved these changes
Sep 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR includes several fixes for RSA-PSS signature verification and key generation issues:
WolfCryptSignature.engineVerify()to correctly pass digest torsaPssVerifyWithDigest()instead of incorrect digest as "full data"RSAPrivateCrtKeykeys inWolfCryptSignature, similar toWolfCryptCipher, since native wolfCrypt requires CRT parameters for RSA ops.RSASSA-PSSKeyPairGeneratorcompatibility with systemKeyFactoryWolfCryptPSSParametersThis PR includes JUnit tests to help prevent regression.
These fixes fix several of the OpenJDK SunJCE tests that were failing with wolfJCE running underneath.