Hardening for AES-CCM sizing/nonce, DH params, PBKDF2 translate, CertPathBuilder floor - #271
Open
cconlon wants to merge 5 commits into
Open
Hardening for AES-CCM sizing/nonce, DH params, PBKDF2 translate, CertPathBuilder floor#271cconlon wants to merge 5 commits into
cconlon wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the wolfJCE provider and JNI glue around several cryptographic edge cases: AES-CCM output sizing/nonce handling, DH AlgorithmParameters encoding/decoding, PBKDF2 translateKey() strictness, and gating CertPathBuilder support on a newer wolfSSL version.
Changes:
- Align AES-CCM behavior with AES-GCM for
Cipher.getOutputSize(), enforce native CCM nonce bounds (7–13 bytes), generate a valid nonce for parameterless init, and reset AEAD tag length to the 128-bit default on parameterless init. - Extend DH AlgorithmParameters DER handling to encode/decode PKCS#3
privateValueLength(l) and reject trailing/invalid elements. - Require PBKDF2
translateKey()source PRF/algorithm to match the targetSecretKeyFactory, and bump CertPathBuilder minimum wolfSSL requirement to 5.9.2+.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/wolfssl/provider/jce/WolfCryptCipher.java | Adds AES-CCM tag/nonce handling and AEAD default tag reset behavior to match native constraints. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java | Adds/extends AES-CCM tests for output sizing, nonce validation, and parameterless init behavior. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptDhParameters.java | Implements DER parsing/encoding for optional DH privateValueLength and rejects trailing data. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptAlgorithmParametersTest.java | Adds DH AlgorithmParameters tests for preserving l and rejecting malformed encodings. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptSecretKeyFactory.java | Makes PBKDF2 translateKey() reject mismatched PRF/algorithm rather than re-deriving. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptSecretKeyFactoryTest.java | Adds regression test ensuring mismatched PBKDF2 PRF translation is rejected. |
| src/main/java/com/wolfssl/wolfcrypt/WolfSSLX509StoreCtx.java | Updates CertPathBuilder support documentation/error text to wolfSSL 5.9.2+. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java | Gates PKIX CertPathBuilder registration on updated wolfSSL 5.9.2+ support check. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptPKIXCertPathBuilderTest.java | Updates test skip guard/message for new CertPathBuilder wolfSSL minimum. |
| jni/jni_wolfssl_x509_store_ctx.c | Raises native availability gate for CertPathBuilder to LIBWOLFSSL_VERSION_HEX >= 0x05009002. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 5 Fenrir fixes:
Cipher.engineGetOutputSize(), matching AES-GCMinit(), generate a valid parameterless nonce, and reset AEAD tag length to the 128-bit defaultprivateValueLength, and reject trailing datatranslateKey()instead of silently re-deriving the keyCertPathBuilderverifier