Expand description
§xml-sec — Pure Rust XML Security
Drop-in replacement for libxmlsec1. XMLDSig, XMLEnc, C14N — no C dependencies.
§Features
- C14N — XML Canonicalization (inclusive + exclusive)
- XMLDSig — XML Digital Signatures (sign + verify)
- XMLEnc — XML Encryption (encrypt + decrypt)
- X.509 — Certificate-based key extraction
§Quick Start
use xml_sec::c14n::{C14nAlgorithm, C14nMode, canonicalize_xml};
let xml = b"<root b=\"2\" a=\"1\"><empty/></root>";
let algo = C14nAlgorithm::new(C14nMode::Inclusive1_0, false);
let canonical = canonicalize_xml(xml, &algo)?;
assert_eq!(
String::from_utf8(canonical)?,
"<root a=\"1\" b=\"2\"><empty></empty></root>"
);Re-exports§
pub use document::XmlDocumentPolicy;pub use document::AttributeIdentity;pub use document::DocumentIdentity;pub use document::DocumentView;pub use document::NamespaceIdentity;pub use document::NodeIdentity;pub use document::SemanticOrder;pub use document::XmlDocument;pub use document::XmlDocumentError;pub use error::XmlSecError;
Modules§
- c14n
- XML Canonicalization (C14N).
- document
- Owned XML documents with stable semantic identities.
- encoding
- XML byte-encoding detection shared by process and transform boundaries.
- error
- Error types for xml-sec.
- policy
- Immutable security policy snapshots shared by XML Security operations.
- provider
- Provider-neutral cryptographic operations.
- xmldsig
- XML Digital Signatures (XMLDSig).
- xmlenc
- XML Encryption (XMLEnc).
Structs§
- Ancestors
- Iterator over a node and its ancestors.
- Attribute
- Borrowed semantic XML attribute.
- Attributes
- Iterator over element attributes.
- Children
- Iterator over direct child nodes.
- Descendants
- Pre-order iterator over a node and its descendants.
- Document
- Parsed backend-neutral XML document.
- Expanded
Name - Expanded XML name used by element and attribute comparisons.
- IdAttribute
Registration - Caller-declared XML ID attribute registration.
- Namespace
- Borrowed in-scope namespace binding.
- Namespaces
- Iterator over in-scope namespace bindings.
- Node
- Copyable handle into a backend-neutral document arena.
- NodeId
- Stable arena index for a node in one parsed document.
- PI
- Processing-instruction payload.
- Parsing
Options - Parser-neutral options used after bounded lexical preflight.
- XmlDom
Document - Parsed backend-neutral XML document.
- XmlDom
Node - Copyable handle into a backend-neutral document arena.
- XmlDom
Node Id - Stable arena index for a node in one parsed document.
- XmlDom
Parsing Options - Parser-neutral options used after bounded lexical preflight.
Enums§
- Node
Type - Kind of a semantic XML node.
- Parse
Error - Stable parser-neutral XML parse error.
- XmlBackend
- XML parser implementation selected for one document or operation.
- XmlDom
Parse Error - Stable parser-neutral XML parse error.