Skip to content
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

removed XML declaration before signature operations #53

Merged
merged 6 commits into from
Jun 10, 2024

Conversation

call-stack
Copy link

Overview/Description

In this merge request, I have implemented a change to the process of generating and validating XML signatures. Specifically, I've removed the XML declaration from documents before these cryptographic operations are performed.

Why the Change Was Necessary

The presence of an XML declaration was found to potentially affect the consistency of the signature generation and validation processes. Differences in the XML prolog presence could lead to mismatches in signature validation, which in turn could compromise the integrity and reliability of the system.

What Was Changed

  • XML Parsing Adjustment: The code now systematically removes the XML declaration from the document before any signature-related processing occurs. This ensures that the XML content fed into the signing and validation processes is consistent, regardless of its original state.
  • Code Refactoring: Minor refactoring was done to enhance the clarity and efficiency of the signature processing functions, aligning with best practices for XML manipulation.

Impact of the Change

This change standardizes how XML documents are handled, removing potential discrepancies that could arise from varying XML prolog presence. As a result, the system's cryptographic operations are now more robust and less prone to errors related to XML formatting differences.

Additional Notes

  • Testing: tests were added to validate xml signature digest with signature digest generate using xmlsec

@call-stack call-stack changed the title removed XML declaration before signature operations Draft: removed XML declaration before signature operations May 4, 2024
@call-stack call-stack marked this pull request as draft May 4, 2024 18:28
@adamdecaf
Copy link
Member

@call-stack Thanks for the PR! It looks like there's a small typo to fix.

@call-stack
Copy link
Author

call-stack commented May 7, 2024

Thanks for fixing the typo.
I had moved this PR to Draft state.
Reason: when we are calling doc.RemoveChild(p) it is keeping the empty line there. I raised it here but the solution provided seems to be changing indentation. Fixed with the new commit.
Etree issue

@call-stack call-stack marked this pull request as ready for review May 7, 2024 17:55
@call-stack call-stack changed the title Draft: removed XML declaration before signature operations removed XML declaration before signature operations May 15, 2024
@adamdecaf adamdecaf merged commit bf61a08 into moov-io:master Jun 10, 2024
3 checks passed
@adamdecaf
Copy link
Member

Thank you for this improvement!

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