Skip to content

feat: implement XMLDSig mutation strategy #76

Description

@polaz

Problem

P2-012 needs the XML mutation layer for XMLDSig signing. The project intentionally uses roxmltree as a read-only parser, so signing cannot rely on mutable DOM behavior like xmlsec1/libxml2.

Solution

Implement a hybrid XML mutation strategy:

  • Use roxmltree to validate/read document structure.
  • Use quick-xml streaming events to produce updated XML.
  • Insert a builder-produced <Signature> element into a source document deterministically.
  • Replace XMLDSig <DigestValue> and <SignatureValue> placeholders in document order without string-splice hacks.
  • Preserve XMLDSig schema ordering required by the existing parser and future signing pipeline.

Acceptance Criteria

  • SignatureBuilder output can be inserted into a source XML document and parsed back successfully.
  • Empty XMLDSig value slots can be filled deterministically in document order.
  • Replacement fails closed when the expected number of XMLDSig value elements is not present.
  • Source document content remains parseable after each mutation pass.
  • Unit/integration tests cover namespace-safe insertion, multiple references, and mismatch errors.
  • Dependencies are updated first, including p256 requirement from 0.13 to 0.14 where compatible.

Estimate

2d total:

  • 3h dependency update and compatibility fixes
  • 6h mutation API implementation
  • 4h regression and integration tests
  • 3h full validation, roadmap/devlog, PR polish

Closes P2-012 roadmap task.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions