pub struct SignatureBuilder { /* private fields */ }Expand description
Builder for a complete XMLDSig <Signature> template.
Implementations§
Source§impl SignatureBuilder
impl SignatureBuilder
Sourcepub fn new(c14n_method: C14nAlgorithm, sign_method: SignatureAlgorithm) -> Self
pub fn new(c14n_method: C14nAlgorithm, sign_method: SignatureAlgorithm) -> Self
Create a signature template using the required algorithms.
Sourcepub fn ns_prefix(self, prefix: impl Into<String>) -> Self
pub fn ns_prefix(self, prefix: impl Into<String>) -> Self
Use a namespace prefix such as ds; the default is an unprefixed namespace.
Sourcepub fn signature_id(self, id: impl Into<String>) -> Self
pub fn signature_id(self, id: impl Into<String>) -> Self
Set the optional Signature Id.
Sourcepub fn signature_context(self, context: SignatureContext) -> Self
pub fn signature_context(self, context: SignatureContext) -> Self
Set the authenticated cryptographic context for a context-capable method. Nonempty contexts on other methods are rejected, never silently ignored.
Sourcepub fn add_reference(self, reference: ReferenceBuilder) -> Self
pub fn add_reference(self, reference: ReferenceBuilder) -> Self
Append a reference, preserving insertion order.
Sourcepub fn key_info(self, include: bool) -> Self
pub fn key_info(self, include: bool) -> Self
Control whether an empty KeyInfo placeholder is emitted.
Sourcepub fn build_template(&self) -> Result<String, SignatureBuilderError>
pub fn build_template(&self) -> Result<String, SignatureBuilderError>
Build a namespace-correct XMLDSig template with empty digest and signature values.
Sourcepub fn build_template_with_policy(
&self,
policy: &SigningPolicy,
) -> Result<String, SignatureBuilderError>
pub fn build_template_with_policy( &self, policy: &SigningPolicy, ) -> Result<String, SignatureBuilderError>
Build a template after enforcing the same immutable policy snapshot used
by the signing operation that will consume it. This key-independent
method validates generated digest widths; SignContext::sign_with_builder
additionally validates the exact key-dependent SignatureValue width.