Skip to content

Validate Root CA client certificate signatures - #14596

Open
zheng1771 wants to merge 2 commits into
apache:4.22from
zheng1771:fix/root-ca-client-validation
Open

zheng1771 wants to merge 2 commits into
apache:4.22from
zheng1771:fix/root-ca-client-validation

Conversation

@zheng1771

Copy link
Copy Markdown

Description

Validate client certificate signatures with the configured Root CA when
strict authentication is enabled.

Run this check before the existing revocation, validity and ownership
checks. Reject the certificate if signature verification fails or the
Root CA certificate is missing. Rejected certificates are not added to
the active certificate map.

Keep the current non-strict authentication and expired certificate
settings. Add six tests using real certificates.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Strict authentication must verify certificates against the configured CA.

Screenshots (if appropriate):

Not applicable.

How Has This Been Tested?

Tested with OpenJDK 17 and Maven 3.8.7.

All 28 tests in RootCACustomTrustManagerTest and RootCAProviderTest passed.
Required modules compiled and Checkstyle passed.

Full project build and live TLS handshake testing were not run.

How did you try to break this feature and the system with this change?

Added tests for:

  • A valid client certificate signed by the configured Root CA.
  • A self-signed client certificate in strict mode.
  • A client certificate signed by a different CA with the same subject.
  • An untrusted client certificate with the trusted root added to its chain.
  • A missing Root CA certificate.
  • A self-signed client certificate in non-strict mode.

Four rejection tests failed before the change and passed after it.
Rejected certificates leave the active certificate map empty.
Existing expiry, revocation and ownership tests also passed.

@DaanHoogland DaanHoogland added this to the 4.22.3 milestone Nov 15, 2026
Comment on lines +95 to +104
if (authStrictness) {
if (caCertificate == null) {
throw new CertificateException("Root CA certificate is required to validate client: " + clientAddress);
}
try {
primaryClientCertificate.verify(caCertificate.getPublicKey());
} catch (final GeneralSecurityException e) {
throw new CertificateException("Client certificate signature verification failed for client: " + clientAddress, e);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can this validation be in a separate method?

This branch has not been deployed

No deployments
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.

2 participants