Get ASN algorithm enum values dynamically#111
Merged
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom May 8, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adjusts the Asn class and its related native interface to dynamically retrieve algorithm enum values rather than using hard-coded constants. The changes include:
- Replacing hard-coded integer assignments in the Asn.java file with dynamic native method calls.
- Updating the error handling in WolfSSLKeyStore.java to work with dynamic algorithm value retrieval.
- Implementing native methods in jni_asn.c and updating the corresponding JNI header to support these changes.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/java/com/wolfssl/wolfcrypt/Asn.java | Updated to initialize algorithm values dynamically using native getters. |
| src/main/java/com/wolfssl/provider/jce/WolfSSLKeyStore.java | Modified control flow to use if/else-if based on dynamic enum values. |
| jni/jni_asn.c | Introduced native method implementations returning algorithm values. |
| jni/include/com_wolfssl_wolfcrypt_Asn.h | Updated header with native method declarations and documentation. |
… flexible if native enum values change
JacobBarthelmeh
approved these changes
May 8, 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 adjusts the
com.wolfssl.wolfcrypt.Asnclass to dynamically get the algorithm ASN enum values (ex:RSAk,ECDSAk, etc) instead of using hard-coded values. This is much more flexible in case these values change at the native level.These hard coded values broke some unit tests after wolfSSL/wolfssl@1e3718e was merged into native wolfSSL.