Struct cryptographic_message_syntax::asn1::rfc5652::SignerInfo
source · [−]pub struct SignerInfo {
pub version: CmsVersion,
pub sid: SignerIdentifier,
pub digest_algorithm: DigestAlgorithmIdentifier,
pub signed_attributes: Option<SignedAttributes>,
pub signature_algorithm: SignatureAlgorithmIdentifier,
pub signature: SignatureValue,
pub unsigned_attributes: Option<UnsignedAttributes>,
pub signed_attributes_data: Option<Vec<u8>>,
}
Expand description
Per-signer information.
SignerInfo ::= SEQUENCE {
version CMSVersion,
sid SignerIdentifier,
digestAlgorithm DigestAlgorithmIdentifier,
signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
signatureAlgorithm SignatureAlgorithmIdentifier,
signature SignatureValue,
unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
Fields
version: CmsVersion
sid: SignerIdentifier
digest_algorithm: DigestAlgorithmIdentifier
signed_attributes: Option<SignedAttributes>
signature_algorithm: SignatureAlgorithmIdentifier
signature: SignatureValue
unsigned_attributes: Option<UnsignedAttributes>
signed_attributes_data: Option<Vec<u8>>
Raw bytes backing signed attributes data.
Does not include constructed tag or length bytes.
Implementations
sourceimpl SignerInfo
impl SignerInfo
pub fn take_opt_from<S: Source>(
cons: &mut Constructed<'_, S>
) -> Result<Option<Self>, S::Err>
pub fn from_sequence<S: Source>(
cons: &mut Constructed<'_, S>
) -> Result<Self, S::Err>
pub fn encode_ref(&self) -> impl Values + '_
sourcepub fn signed_attributes_digested_content(
&self
) -> Result<Option<Vec<u8>>, Error>
pub fn signed_attributes_digested_content(
&self
) -> Result<Option<Vec<u8>>, Error>
Obtain content representing the signed attributes data to be digested.
Computing the content to go into the digest calculation is nuanced. From RFC 5652:
The result of the message digest calculation process depends on
whether the signedAttrs field is present. When the field is absent,
the result is just the message digest of the content as described
above. When the field is present, however, the result is the message
digest of the complete DER encoding of the SignedAttrs value
contained in the signedAttrs field. Since the SignedAttrs value,
when present, must contain the content-type and the message-digest
attributes, those values are indirectly included in the result. The
content-type attribute MUST NOT be included in a countersignature
unsigned attribute as defined in Section 11.4. A separate encoding
of the signedAttrs field is performed for message digest calculation.
The IMPLICIT [0]
tag in the signedAttrs is not used for the DER
encoding, rather an EXPLICIT SET OF tag is used. That is, the DER
encoding of the EXPLICIT SET OF tag, rather than of the IMPLICIT [0]
tag, MUST be included in the message digest calculation along with
the length and content octets of the SignedAttributes value.
A few things to note here:
- We must ensure DER (not BER) encoding of the entire SignedAttrs values.
- The SignedAttr tag must use
EXPLICIT SET OF
instead ofIMPLICIT [0]
, so default encoding is not appropriate. - If this instance came into existence via a parse, we stashed away the raw bytes constituting SignedAttributes to ensure we can do a lossless copy.
Trait Implementations
sourceimpl Clone for SignerInfo
impl Clone for SignerInfo
sourcefn clone(&self) -> SignerInfo
fn clone(&self) -> SignerInfo
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SignerInfo
impl Debug for SignerInfo
sourceimpl PartialEq<SignerInfo> for SignerInfo
impl PartialEq<SignerInfo> for SignerInfo
sourcefn eq(&self, other: &SignerInfo) -> bool
fn eq(&self, other: &SignerInfo) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SignerInfo) -> bool
fn ne(&self, other: &SignerInfo) -> bool
This method tests for !=
.
sourceimpl TryFrom<&'_ SignerInfo> for SignerInfo
impl TryFrom<&'_ SignerInfo> for SignerInfo
sourceimpl Values for SignerInfo
impl Values for SignerInfo
sourcefn encoded_len(&self, mode: Mode) -> usize
fn encoded_len(&self, mode: Mode) -> usize
Returns the length of the encoded values for the given mode.
sourcefn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
Encodes the values in the given mode and writes them to target
.
sourcefn explicit(self, tag: Tag) -> Constructed<Self>
fn explicit(self, tag: Tag) -> Constructed<Self>
Converts the encoder into one with an explicit tag.
sourcefn to_captured(&self, mode: Mode) -> Captured
fn to_captured(&self, mode: Mode) -> Captured
Captures the encoded values in the given mode.
impl Eq for SignerInfo
impl StructuralEq for SignerInfo
impl StructuralPartialEq for SignerInfo
Auto Trait Implementations
impl RefUnwindSafe for SignerInfo
impl Send for SignerInfo
impl Sync for SignerInfo
impl Unpin for SignerInfo
impl UnwindSafe for SignerInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more