Add utility method to convert JKS/PKCS12 KeyStore streams to WKS type#108
Merged
douzzer merged 2 commits intowolfSSL:masterfrom May 16, 2025
Merged
Add utility method to convert JKS/PKCS12 KeyStore streams to WKS type#108douzzer merged 2 commits intowolfSSL:masterfrom
douzzer merged 2 commits intowolfSSL:masterfrom
Conversation
c61f09e to
8babef8
Compare
8babef8 to
96af485
Compare
96af485 to
5dd856b
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new JCE-level utility method to convert JKS/PKCS12 KeyStore streams to the WKS format and includes associated tests, documentation updates, and a minor fix in WolfSSLKeyStore.
- Introduces WolfCryptUtil.convertKeyStoreToWKS() for runtime KeyStore format conversion.
- Updates the test suite to validate the new conversion method.
- Fixes the usage of local KDF iterations in WolfSSLKeyStore and enhances log messaging.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/wolfssl/provider/jce/test/WolfSSLKeyStoreTest.java | Removed an extraneous comment. |
| src/test/java/com/wolfssl/provider/jce/test/WolfJCETestSuite.java | Updated test suite to include new utility tests. |
| src/main/java/com/wolfssl/provider/jce/WolfSSLKeyStore.java | Adjusted KDF iterations usage and added logging for null InputStreams. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptUtil.java | Added a new utility method for KeyStore conversion with comprehensive format detection. |
| scripts/infer.sh | Updated static analysis configuration to include the new utility class. |
| README_JCE.md | Revised documentation to include instructions and usage details for the new conversion method. |
Comments suppressed due to low confidence (1)
src/test/java/com/wolfssl/provider/jce/test/WolfSSLKeyStoreTest.java:1432
- [nitpick] It appears that an extraneous comment was removed. Ensure that any comments in test files are meaningful and align with the intended documentation for future maintainability.
//CHRIS
…ase Security property iteration count has changed
5dd856b to
bda62a8
Compare
douzzer
approved these changes
May 16, 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 adds a JCE-level utility method which can be used to convert existing
JKS/PKCS12KeyStoreInputStreamobjects into aWKS(WolfSSLKeyStore) type:This can be useful if WKS type KeyStores need to be used for FIPS compliance, but existing JKS/PKCS12 types need to be converted. This helper method itself will call Sun providers for reading the JKS/PKCS12 entries, before storing them back into a WKS KeyStore. Caution should be taken that calling this code can result in calling down to non-FIPS validated cryptography in those cases when using wolfCrypt FIPS underneath wolfJCE.
This PR also updates
README_JCE.mdwith usage notes, and adds new JUnit tests for this utility method:This PR also contains one small fix to
WolfSSLKeyStore.java, specifically:WKSPrivateKeywhen callinggetDecryptedKey()instead of using the KDF iteration default set by the Security properties. When decrypting, we need to use the local set value, incase the KDF iterations have changed at the system level. The system level iteration count will still be used for the creation of any new key derivations.ZD 17962