pub struct SignerInfoBuilder<'s, S> { /* private fields */ }
Available on crate feature builder only.
Expand description

Collect info needed for creating a SignerInfo. Calling build() on this struct will

  • calculate the correct CMSVersion (depends on sid)
  • calculate the signature
  • set the signing time attribute
  • create a SignerInfo object

Implementations§

source§

impl<'s, S> SignerInfoBuilder<'s, S>

source

pub fn new( signer: &'s S, sid: SignerIdentifier, digest_algorithm: AlgorithmIdentifierOwned, encapsulated_content_info: &'s EncapsulatedContentInfo, external_message_digest: Option<&'s [u8]> ) -> Result<Self, Error>

Create a new SignerInfoBuilder. This is used for adding SignerInfos to SignedData structures. The content to be signed can be stored externally. In this case eContent in encapsulated_content_info must be None and the message digest must be passed with external_message_digest. digest_algorithm must match the used digest algorithm.

source

pub fn add_signed_attribute( &mut self, signed_attribute: Attribute ) -> Result<&mut Self, Error>

Add a “signed” attribute. The attribute will be signed together with the other “signed” attributes, when build() is called.

source

pub fn add_unsigned_attribute( &mut self, unsigned_attribute: Attribute ) -> Result<&mut Self, Error>

Add an unsigned attribute.

source

pub fn version(&self) -> CmsVersion

Calculate the CMSVersion of the signer info. Intended to be called during building the SignerInfo. RFC 5652 § 5.3: version is the syntax version number. If the SignerIdentifier is the CHOICE issuerAndSerialNumber, then the version MUST be 1. If the SignerIdentifier is subjectKeyIdentifier, then the version MUST be 3.

Trait Implementations§

source§

impl<'s, S> Builder for SignerInfoBuilder<'s, S>

source§

fn finalize(&mut self) -> Result<Vec<u8>>

Calculate the data to be signed RFC 5652 § 5.4 If an external_message_digest is passed in, it is assumed, that we are signing external content (see RFC 5652 § 5.2). In this case, the eContent in EncapsulatedContentInfo must be None.

§

type Signer = S

The builder’s object signer
§

type Output = SignerInfo

Type built by this builder
source§

fn signer(&self) -> &Self::Signer

Return a reference to the signer.
source§

fn assemble(self, signature: BitString) -> Result<Self::Output, Error>

Assemble the final object from signature.
source§

fn build<Signature>(self) -> Result<Self::Output, Error>
where Self::Signer: Signer<Signature>, Signature: SignatureBitStringEncoding,

Run the object through the signer and build it.
source§

fn build_with_rng<Signature>( self, rng: &mut impl CryptoRngCore ) -> Result<Self::Output, Error>
where Self::Signer: RandomizedSigner<Signature>, Signature: SignatureBitStringEncoding,

Run the object through the signer and build it.

Auto Trait Implementations§

§

impl<'s, S> RefUnwindSafe for SignerInfoBuilder<'s, S>
where S: RefUnwindSafe,

§

impl<'s, S> Send for SignerInfoBuilder<'s, S>
where S: Sync,

§

impl<'s, S> Sync for SignerInfoBuilder<'s, S>
where S: Sync,

§

impl<'s, S> Unpin for SignerInfoBuilder<'s, S>

§

impl<'s, S> UnwindSafe for SignerInfoBuilder<'s, S>
where S: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V