Skip to content

Fix #110: Implement certificate chain validation for trusted field #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ic0ns
Copy link
Contributor

@ic0ns ic0ns commented Jun 27, 2025

Summary

This PR implements certificate chain validation to properly set the trusted field in CertificateReport, which was previously always null as reported in issue #110.

Changes

  • Added CertificateChainValidator class that validates certificate chains against loaded trust anchors
  • Modified CertificateReportGenerator to:
    • Accept the full certificate chain context when generating reports
    • Use the validator to determine if a certificate is trusted
    • Set the trusted field based on validation results
  • Added basic unit tests for the new functionality

Implementation Details

The validator checks if:

  1. Any certificate in the chain is itself a trust anchor
  2. The certificate chain terminates at a trust anchor

This provides a basic but functional validation that addresses the issue. The implementation reuses the existing TrustAnchorManager infrastructure without requiring complex certificate path validation.

Test Plan

  • Code compiles successfully
  • Spotless formatting applied
  • Basic unit tests added
  • Manual testing with real certificate chains would be beneficial

Fixes #110

This commit addresses issue #110 by implementing certificate chain validation
to properly set the 'trusted' field in CertificateReport.

Changes:
- Added CertificateChainValidator class to validate certificate chains against trust anchors
- Modified CertificateReportGenerator to use the validator when a full chain is available
- Added overloaded generateReport method that accepts the full certificate chain
- The 'trusted' field is now set based on whether the certificate chain validates to a trusted root

The implementation checks if any certificate in the chain is a trust anchor
or if the chain terminates at a trust anchor. This provides a basic but functional
validation that resolves the issue where the 'trusted' field was always null.
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.

[Question] Trusted CAs
1 participant