pub enum SignerIdentifier {
IssuerAndSerialNumber(IssuerAndSerialNumber),
SubjectKeyIdentifier(OctetString),
}Expand description
Identifies the signer.
SignerIdentifier ::= CHOICE {
issuerAndSerialNumber IssuerAndSerialNumber,
subjectKeyIdentifier [0] SubjectKeyIdentifier }Variants§
IssuerAndSerialNumber(IssuerAndSerialNumber)
SubjectKeyIdentifier(OctetString)
Implementations§
source§impl SignerIdentifier
impl SignerIdentifier
sourcepub fn take_from<S: Source>(
cons: &mut Constructed<'_, S>
) -> Result<Self, DecodeError<S::Error>>
pub fn take_from<S: Source>(
cons: &mut Constructed<'_, S>
) -> Result<Self, DecodeError<S::Error>>
Examples found in repository?
src/asn1/rfc5652.rs (line 395)
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
pub fn from_sequence<S: Source>(
cons: &mut Constructed<S>,
) -> Result<Self, DecodeError<S::Error>> {
let version = CmsVersion::take_from(cons)?;
let sid = SignerIdentifier::take_from(cons)?;
let digest_algorithm = DigestAlgorithmIdentifier::take_from(cons)?;
let signed_attributes = cons.take_opt_constructed_if(Tag::CTX_0, |cons| {
// RFC 5652 Section 5.3: SignedAttributes MUST be DER encoded, even if the
// rest of the structure is BER encoded. So buffer all data so we can
// feed into a new decoder.
let der = cons.capture_all()?;
// But wait there's more! The raw data constituting the signed
// attributes is also digested and used for content/signature
// verification. Because our DER serialization may not roundtrip
// losslessly, we stash away a copy of these bytes so they may be
// referenced as part of verification.
let der_data = der.as_slice().to_vec();
Ok((
Constructed::decode(der.as_slice(), bcder::Mode::Der, |cons| {
SignedAttributes::take_from_set(cons)
})
.map_err(|e| e.convert())?,
der_data,
))
})?;
let (signed_attributes, signed_attributes_data) = if let Some((x, y)) = signed_attributes {
(Some(x), Some(y))
} else {
(None, None)
};
let signature_algorithm = SignatureAlgorithmIdentifier::take_from(cons)?;
let signature = SignatureValue::take_from(cons)?;
let unsigned_attributes = cons
.take_opt_constructed_if(Tag::CTX_1, |cons| UnsignedAttributes::take_from_set(cons))?;
Ok(Self {
version,
sid,
digest_algorithm,
signed_attributes,
signature_algorithm,
signature,
unsigned_attributes,
signed_attributes_data,
})
}Trait Implementations§
source§impl Clone for SignerIdentifier
impl Clone for SignerIdentifier
source§fn clone(&self) -> SignerIdentifier
fn clone(&self) -> SignerIdentifier
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for SignerIdentifier
impl Debug for SignerIdentifier
source§impl PartialEq<SignerIdentifier> for SignerIdentifier
impl PartialEq<SignerIdentifier> for SignerIdentifier
source§fn eq(&self, other: &SignerIdentifier) -> bool
fn eq(&self, other: &SignerIdentifier) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Values for SignerIdentifier
impl Values for SignerIdentifier
source§fn encoded_len(&self, mode: Mode) -> usize
fn encoded_len(&self, mode: Mode) -> usize
Returns the length of the encoded values for the given mode.
source§fn 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.source§fn explicit(self, tag: Tag) -> Constructed<Self>where
Self: Sized,
fn explicit(self, tag: Tag) -> Constructed<Self>where
Self: Sized,
Converts the encoder into one with an explicit tag.
source§fn to_captured(&self, mode: Mode) -> Captured
fn to_captured(&self, mode: Mode) -> Captured
Captures the encoded values in the given mode.
impl Eq for SignerIdentifier
impl StructuralEq for SignerIdentifier
impl StructuralPartialEq for SignerIdentifier
Auto Trait Implementations§
impl RefUnwindSafe for SignerIdentifier
impl Send for SignerIdentifier
impl Sync for SignerIdentifier
impl Unpin for SignerIdentifier
impl UnwindSafe for SignerIdentifier
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.