pub struct CmsSignedData<'a> {
pub signer_key_id: &'a [u8],
pub cd_content: &'a [u8],
pub signature_raw: [u8; 64],
}Expand description
Parsed contents of a CMS SignedData envelope
Fields§
§signer_key_id: &'a [u8]SubjectKeyIdentifier from the SignerInfo (identifies the signing key)
cd_content: &'a [u8]Raw TLV CD payload (the encapsulated content)
signature_raw: [u8; 64]ECDSA signature in raw (r || s) format, 64 bytes
Implementations§
Source§impl<'a> CmsSignedData<'a>
impl<'a> CmsSignedData<'a>
Sourcepub fn parse(cms_message: &'a [u8]) -> Result<CmsSignedData<'a>, Error>
pub fn parse(cms_message: &'a [u8]) -> Result<CmsSignedData<'a>, Error>
Parse a CMS SignedData message, extracting the signer key ID, encapsulated CD content, and ECDSA signature (converted from DER to raw).
Expects the profiled CMS structure used by Matter CDs (Matter Spec): https://www.rfc-editor.org/rfc/rfc5652#section-5.2
ContentInfo ::= SEQUENCE {
contentType OBJECT IDENTIFIER id-signedData (1.2.840.113549.1.7.2),
content [0] EXPLICIT SignedData
}
SignedData ::= SEQUENCE {
version INTEGER (v3(3)),
digestAlgorithms SET { OBJECT IDENTIFIER sha256 (2.16.840.1.101.3.4.2.1) },
encapContentInfo EncapsulatedContentInfo,
signerInfos SET { SignerInfo }
}
EncapsulatedContentInfo ::= SEQUENCE {
eContentType OBJECT IDENTIFIER pkcs7-data (1.2.840.113549.1.7.1),
eContent [0] EXPLICIT OCTET STRING cd_content
}
SignerInfo ::= SEQUENCE {
version INTEGER (v3(3)),
subjectKeyIdentifier [0] IMPLICIT OCTET STRING,
digestAlgorithm OBJECT IDENTIFIER sha256 (2.16.840.1.101.3.4.2.1),
signatureAlgorithm OBJECT IDENTIFIER ecdsa-with-SHA256 (1.2.840.10045.4.3.2),
signature OCTET STRING
}Auto Trait Implementations§
impl<'a> Freeze for CmsSignedData<'a>
impl<'a> RefUnwindSafe for CmsSignedData<'a>
impl<'a> Send for CmsSignedData<'a>
impl<'a> Sync for CmsSignedData<'a>
impl<'a> Unpin for CmsSignedData<'a>
impl<'a> UnsafeUnpin for CmsSignedData<'a>
impl<'a> UnwindSafe for CmsSignedData<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, I> IntoFallibleInit<T> for Iwhere
I: Init<T>,
impl<T, I> IntoFallibleInit<T> for Iwhere
I: Init<T>,
Source§fn into_fallible<E>(self) -> impl Init<T, E>
fn into_fallible<E>(self) -> impl Init<T, E>
Convert the infallible initializer to a fallible one.
Source§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
Source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
Source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.