[stable31] chore: Refactor certificate chain processing with ordering#5585
Merged
vitormattos merged 3 commits intostable31from Oct 16, 2025
Merged
[stable31] chore: Refactor certificate chain processing with ordering#5585vitormattos merged 3 commits intostable31from
vitormattos merged 3 commits intostable31from
Conversation
…orithm and validation - **Certificate Ordering (OrderCertificatesTrait):** - Implement new leaf-first ordering algorithm with proper chain building - Add Distinguished Name normalization for reliable certificate comparison - Introduce comprehensive chain validation with `validateCertificateChain()` - Handle complex multi-level certificate hierarchies and edge cases - Improve error handling with detailed validation messages - **PDF Signature Processing (Pkcs12Handler):** - Refactor `getCertificateChain()` method with extracted helper functions - Improve TSA timestamp processing and certificate chain extraction - Clean up code organization and remove unnecessary comments - Enhance certificate data enrichment from Poppler utilities - **Test Coverage Improvements:** - Add 300+ lines of comprehensive test cases covering real-world scenarios - Include banking, corporate, and e-commerce certificate chain examples - Add validation tests for complete, incomplete, and invalid chains - Refactor Pkcs12Handler tests to focus on public interface without reflection - Remove excessive mocking in favor of behavioral testing - **Code Quality:** - Follow best practices by testing only public methods - Eliminate reflection-based testing for better maintainability - Improve test reliability and reduce brittleness to internal changes - Clean up code structure and remove redundant documentation This enhancement significantly improves certificate chain handling reliability for digital signature validation in LibreSign, with comprehensive test coverage ensuring robustness across various PKI scenarios. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of PR #5584