Struct cryptographic_message_syntax::asn1::rfc5652::SignerInfo[][src]

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>>,
}

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: CmsVersionsid: SignerIdentifierdigest_algorithm: DigestAlgorithmIdentifiersigned_attributes: Option<SignedAttributes>signature_algorithm: SignatureAlgorithmIdentifiersignature: SignatureValueunsigned_attributes: Option<UnsignedAttributes>signed_attributes_data: Option<Vec<u8>>

Raw bytes backing signed attributes data.

Does not include constructed tag or length bytes.

Implementations

impl SignerInfo[src]

pub fn take_opt_from<S: Source>(
    cons: &mut Constructed<'_, S>
) -> Result<Option<Self>, S::Err>
[src]

pub fn from_sequence<S: Source>(
    cons: &mut Constructed<'_, S>
) -> Result<Self, S::Err>
[src]

pub fn encode_ref(&self) -> impl Values + '_[src]

pub fn signed_attributes_digested_content(
    &self
) -> Result<Option<Vec<u8>>, Error>
[src]

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 of IMPLICIT [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

impl Clone for SignerInfo[src]

impl Debug for SignerInfo[src]

impl Eq for SignerInfo[src]

impl PartialEq<SignerInfo> for SignerInfo[src]

impl StructuralEq for SignerInfo[src]

impl StructuralPartialEq for SignerInfo[src]

impl TryFrom<&'_ SignerInfo> for SignerInfo[src]

type Error = CmsError

The type returned in the event of a conversion error.

impl Values for SignerInfo[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.