pub struct SignatureInput { /* private fields */ }integrity only.Expand description
An ordered, validated RFC 9421 inner list and its signature parameters.
RFC 8941 serialization preserves received component/parameter order, including unknown signature parameters. Component identity compares parameter sets without depending on their order, so equivalent duplicates are rejected. At most 64 components and 64 KiB of serialized metadata are accepted.
Implementations§
Source§impl SignatureInput
impl SignatureInput
Sourcepub fn new(
components: Vec<Component>,
params: SignatureParams,
) -> Result<Self, Error>
pub fn new( components: Vec<Component>, params: SignatureParams, ) -> Result<Self, Error>
Creates an input with alg="ed25519", using Structured Fields escaping.
Sourcepub fn parse(value: &str) -> Result<Self, Error>
pub fn parse(value: &str) -> Result<Self, Error>
Parses the inner-list value, excluding the dictionary label (sig1=).
Sourcepub fn from_message(message: &Message, label: &str) -> Result<Self, Error>
pub fn from_message(message: &Message, label: &str) -> Result<Self, Error>
Extracts the selected signature input from headers and/or trailers. Duplicate labels across sections are rejected as an application policy.
Sourcepub fn components(&self) -> &[Component]
pub fn components(&self) -> &[Component]
Returns the ordered covered components.
Sourcepub fn parameter(&self, name: &str) -> Option<&str>
pub fn parameter(&self, name: &str) -> Option<&str>
Returns a string parameter, including preserved extension parameters.
Sourcepub fn integer_parameter(&self, name: &str) -> Option<i64>
pub fn integer_parameter(&self, name: &str) -> Option<i64>
Returns an integer parameter.
Sourcepub fn to_field_value(&self) -> String
pub fn to_field_value(&self) -> String
Serializes the original ordered inner list with strict SF serialization.
Sourcepub fn signature_base(&self, message: &Message) -> Result<Vec<u8>, Error>
pub fn signature_base(&self, message: &Message) -> Result<Vec<u8>, Error>
Creates the RFC 9421 signature base, without a final newline. This contains covered credentials; callers must not log it indiscriminately.
Sourcepub fn verify(
&self,
message: &Message,
signature: &[u8],
key: &VerifyingKey,
) -> Result<(), Error>
pub fn verify( &self, message: &Message, signature: &[u8], key: &VerifyingKey, ) -> Result<(), Error>
Verifies Ed25519 only. Freshness, required coverage, authorization, replay,
and body integrity are separate; use Verifier and body adapters for a
policy-checked message. This primitive also supports static RFC fixtures.