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.
Problem
P2-012 needs the XML mutation layer for XMLDSig signing. The project intentionally uses
roxmltreeas a read-only parser, so signing cannot rely on mutable DOM behavior like xmlsec1/libxml2.Solution
Implement a hybrid XML mutation strategy:
roxmltreeto validate/read document structure.quick-xmlstreaming events to produce updated XML.<Signature>element into a source document deterministically.<DigestValue>and<SignatureValue>placeholders in document order without string-splice hacks.Acceptance Criteria
SignatureBuilderoutput can be inserted into a source XML document and parsed back successfully.p256requirement from0.13to0.14where compatible.Estimate
2d total:
Closes P2-012 roadmap task.