Skip to content

Add pathLen support toWolfSSLCertificate/WolfSSLCertRequest addExtension()#341

Merged
rlm2002 merged 1 commit intowolfSSL:masterfrom
cconlon:pathLenFix
Mar 18, 2026
Merged

Add pathLen support toWolfSSLCertificate/WolfSSLCertRequest addExtension()#341
rlm2002 merged 1 commit intowolfSSL:masterfrom
cconlon:pathLenFix

Conversation

@cconlon
Copy link
Copy Markdown
Member

@cconlon cconlon commented Mar 10, 2026

This PR adds an addExtension(int nid, boolean value, int pathLen, boolean isCritical) overload to WolfSSLCertificate and WolfSSLCertRequest for setting Basic Constraints with a path length constraint.

Existing 3-arg addExtension(nid, boolean, boolean) now delegates to the new method with pathLen=-1 to avoid code duplication.

This is version guarded with WOLFSSL_PR9940_PATCH_APPLIED for wolfSSL users <= 5.8.4 who don't have the fixes made in wolfSSL/wolfssl#9940, unless a patch is applied for that PR diff.

Basic JUnit tests are included as well for regression prevention.

@cconlon cconlon self-assigned this Mar 10, 2026
Copilot AI review requested due to automatic review settings March 10, 2026 22:50
@cconlon cconlon changed the title Add pathLen support to Basic Constraints in WolfSSLCertificate/WolfSSLCertRequest addExtension() Add pathLen support toWolfSSLCertificate/WolfSSLCertRequest addExtension() Mar 10, 2026
Copy link
Copy Markdown

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

Adds Basic Constraints pathLenConstraint support to the Java certificate/CSR extension APIs, bridging through JNI into wolfSSL (with compile-time guards for wolfSSL versions lacking the required upstream fixes).

Changes:

  • Added addExtension(int nid, boolean value, int pathLen, boolean isCritical) overloads to WolfSSLCertificate and WolfSSLCertRequest; legacy 3-arg overload delegates with pathLen = -1.
  • Extended JNI/native implementations to accept a pathLen parameter and attempt to encode it into Basic Constraints.
  • Added JUnit coverage for valid/invalid pathLen and a DER round-trip test for generated certificates.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/java/com/wolfssl/WolfSSLCertificate.java Adds new Basic Constraints overload and updates native call + error handling.
src/java/com/wolfssl/WolfSSLCertRequest.java Adds new Basic Constraints overload and updates native call + error handling.
native/com_wolfssl_WolfSSLCertificate.h Updates JNI signature for boolean-extension native method.
native/com_wolfssl_WolfSSLCertificate.c Implements pathLen handling and version guard in native Basic Constraints setter.
native/com_wolfssl_WolfSSLCertRequest.h Updates JNI signature for boolean-extension native method.
native/com_wolfssl_WolfSSLCertRequest.c Implements pathLen handling and version guard in native Basic Constraints setter.
src/test/com/wolfssl/test/WolfSSLCertificateTest.java Adds extension-setter coverage and DER round-trip generation test for pathLen.
src/test/com/wolfssl/test/WolfSSLCertRequestTest.java Adds CSR extension-setter tests for pathLen and invalid inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/java/com/wolfssl/WolfSSLCertificate.java
Comment thread src/java/com/wolfssl/WolfSSLCertRequest.java
Comment thread native/com_wolfssl_WolfSSLCertificate.c
Comment thread native/com_wolfssl_WolfSSLCertRequest.c
Comment thread src/java/com/wolfssl/WolfSSLCertRequest.java Outdated
Comment thread src/java/com/wolfssl/WolfSSLCertificate.java Outdated
Copilot AI review requested due to automatic review settings March 11, 2026 17:47
Copy link
Copy Markdown

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/find-pr-info.sh Outdated
Comment thread src/java/com/wolfssl/WolfSSLCertificate.java
Comment thread src/java/com/wolfssl/WolfSSLCertRequest.java
Comment thread src/test/com/wolfssl/test/WolfSSLCertificateTest.java Outdated
@rlm2002 rlm2002 assigned cconlon and unassigned cconlon and rlm2002 Mar 13, 2026
@cconlon
Copy link
Copy Markdown
Member Author

cconlon commented Mar 16, 2026

Will rebase once #343 gets in.

Copilot AI review requested due to automatic review settings March 17, 2026 19:46
Copy link
Copy Markdown

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/java/com/wolfssl/WolfSSLCertificate.java
Comment thread native/com_wolfssl_WolfSSLCertRequest.c
Comment thread src/test/com/wolfssl/test/WolfSSLCertRequestTest.java
@rlm2002 rlm2002 merged commit b635b5b into wolfSSL:master Mar 18, 2026
104 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.

3 participants