Skip to content

Add DN-based constructors to WolfSSLX509Name#366

Open
cconlon wants to merge 1 commit intowolfSSL:masterfrom
cconlon:x509name-dn-constructors
Open

Add DN-based constructors to WolfSSLX509Name#366
cconlon wants to merge 1 commit intowolfSSL:masterfrom
cconlon:x509name-dn-constructors

Conversation

@cconlon
Copy link
Copy Markdown
Member

@cconlon cconlon commented May 5, 2026

This PR adds two new constructors to WolfSSLX509Name:

  • Adds WolfSSLX509Name(String) and WolfSSLX509Name(X500Principal) constructors so callers can populate a name from a parsed DN instead of calling each setXxx() individually.
    • String constructor auto-detects RFC 2253 / RFC 4514 (CN=foo,O=bar,C=US) vs OpenSSL oneline (/C=US/O=bar/CN=foo).
    • RFC 2253 parsing is done with a small custom parser (no javax.naming.* dependency) so the file compiles on Android. Callers who already have a javax.naming.ldap.LdapName can pass myLdapName.toString() since LdapName's string form is RFC 2253.
    • Adds title, domainComponent, and serialNumber mirror fields with matching setX/getX methods so the canonicalization table and mirror set stay in sync. Tests for these are gated behind Assume.assumeTrue since wolfSSL only added these three to its OBJ table in v5.8.2.
    • Multi-valued RDNs throw WolfSSLException, since native wolfSSL_X509_NAME_add_entry() currently ignores the set flag.

Includes new JUnit tests for regression prevention.

Copilot AI review requested due to automatic review settings May 5, 2026 22:23
@cconlon cconlon self-assigned this May 5, 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

Note

Copilot was unable to run its full agentic suite in this review.

Adds DN-based WolfSSLX509Name constructors so callers can build names from RFC 2253/OpenSSL oneline strings, LdapName, or X500Principal, and adds JUnit coverage for the new parsing paths.

Changes:

  • Added three new WolfSSLX509Name constructors plus helper methods for DN parsing, attribute normalization, and mirror-field updates.
  • Added a comprehensive new WolfSSLX509NameTest class covering valid and invalid RFC 2253/oneline/LDAP/X500Principal inputs.
  • Registered the new test class in the main JUnit test suite.

Reviewed changes

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

File Description
src/java/com/wolfssl/WolfSSLX509Name.java Implements the new DN-based constructors and parsing/normalization helpers.
src/test/com/wolfssl/test/WolfSSLX509NameTest.java Adds regression tests for the new constructors and error cases.
src/test/com/wolfssl/test/WolfSSLTestSuite.java Includes the new test class in the suite.

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

Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
@cconlon cconlon force-pushed the x509name-dn-constructors branch 2 times, most recently from 06a6e96 to 3e340d9 Compare May 6, 2026 20:50
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 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
Comment thread src/java/com/wolfssl/WolfSSLX509Name.java
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #366

Scan targets checked: wolfssljni-bugs, wolfssljni-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
@cconlon cconlon force-pushed the x509name-dn-constructors branch from 3e340d9 to 2b7692b Compare May 6, 2026 22:02
@cconlon cconlon requested a review from Copilot May 6, 2026 22:02
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 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread src/java/com/wolfssl/WolfSSLX509Name.java
Comment thread src/java/com/wolfssl/WolfSSLX509Name.java Outdated
@cconlon cconlon force-pushed the x509name-dn-constructors branch from 2b7692b to e013b63 Compare May 6, 2026 22:32
@cconlon cconlon assigned rlm2002 and unassigned cconlon May 8, 2026
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