pub struct SignContext<'a> { /* private fields */ }Expand description
XMLDSig signing context.
Implementations§
Source§impl<'a> SignContext<'a>
impl<'a> SignContext<'a>
Sourcepub fn new(signing_key: &'a dyn SigningKey) -> Self
pub fn new(signing_key: &'a dyn SigningKey) -> Self
Create a signing context using the supplied private key.
Sourcepub fn key_info_writer(self, writer: &'a dyn KeyInfoWriter) -> Self
pub fn key_info_writer(self, writer: &'a dyn KeyInfoWriter) -> Self
Configure signing to populate the direct <Signature>/<KeyInfo> placeholder.
Sourcepub fn xpath_here_semantics(self, semantics: XPathHereSemantics) -> Self
pub fn xpath_here_semantics(self, semantics: XPathHereSemantics) -> Self
Select the node returned by XPath’s here() extension function.
The default follows XMLDSig and returns the <XPath> parameter.
XPathHereSemantics::XmlSecLegacy is available only for producing
signatures compatible with libxmlsec1’s <Transform> interpretation.
Sourcepub fn sign_template(&self, xml: &str) -> Result<String, SigningError>
pub fn sign_template(&self, xml: &str) -> Result<String, SigningError>
Sign XML that already contains a <Signature> template.
The template must include empty <DigestValue> and <SignatureValue>
targets. The pipeline fills reference digests, reparses the result,
canonicalizes <SignedInfo>, signs those canonical bytes, and fills the
base64 <SignatureValue>.
Sourcepub fn sign_with_builder(
&self,
xml: &str,
builder: &SignatureBuilder,
) -> Result<String, SigningError>
pub fn sign_with_builder( &self, xml: &str, builder: &SignatureBuilder, ) -> Result<String, SigningError>
Build a signature template, append it to the source root, then sign it.