Skip to content

Get ASN algorithm enum values dynamically#111

Merged
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
cconlon:oidFix
May 8, 2025
Merged

Get ASN algorithm enum values dynamically#111
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
cconlon:oidFix

Conversation

@cconlon
Copy link
Member

@cconlon cconlon commented May 8, 2025

This PR adjusts the com.wolfssl.wolfcrypt.Asn class 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.

@cconlon cconlon self-assigned this May 8, 2025
@cconlon cconlon requested a review from Copilot May 8, 2025 20:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JacobBarthelmeh JacobBarthelmeh merged commit 783c927 into wolfSSL:master May 8, 2025
76 of 77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants