pub struct CertGenerator<'a> { /* private fields */ }Expand description
One-shot Matter-TLV certificate generator writing into a caller-supplied buffer.
Typical callers are the three issuers in crate::onboard::cac
(RCAC, ICAC) and crate::onboard::noc (NOC); each one
constructs a CertGenerator over its scratch buffer, calls
Self::generate once and discards the generator. Subject /
issuer / pubkey / signing-key consistency is the caller’s
responsibility — generate only checks invariants generic across
cert types (serial number well-formedness).
Implementations§
Source§impl<'a> CertGenerator<'a>
impl<'a> CertGenerator<'a>
Sourcepub const fn new(buf: &'a mut [u8]) -> CertGenerator<'a>
pub const fn new(buf: &'a mut [u8]) -> CertGenerator<'a>
Create a new generator over the given output buffer.
Sourcepub fn generate<C>(
&mut self,
crypto: C,
cert_type: CertType,
serial_number: &[u8],
validity: Validity,
subject: SubjectDN<'_>,
issuer: IssuerDN,
subject_pubkey: CryptoSensitiveRef<'_, rs_matter::::crypto::canon::CanonPkcPublicKeyRef::{constant#0}>,
issuer_pubkey: Option<CryptoSensitiveRef<'_, rs_matter::::crypto::canon::CanonPkcPublicKeyRef::{constant#0}>>,
signing_key: &<C as Crypto>::SecretKey<'_>,
) -> Result<usize, Error>where
C: Crypto,
pub fn generate<C>(
&mut self,
crypto: C,
cert_type: CertType,
serial_number: &[u8],
validity: Validity,
subject: SubjectDN<'_>,
issuer: IssuerDN,
subject_pubkey: CryptoSensitiveRef<'_, rs_matter::::crypto::canon::CanonPkcPublicKeyRef::{constant#0}>,
issuer_pubkey: Option<CryptoSensitiveRef<'_, rs_matter::::crypto::canon::CanonPkcPublicKeyRef::{constant#0}>>,
signing_key: &<C as Crypto>::SecretKey<'_>,
) -> Result<usize, Error>where
C: Crypto,
Generate a Matter-TLV certificate of the given kind, sign it, and return the length written to the buffer.
issuer_pubkey must be None for CertType::Rcac
(self-signed: AKID = SKID) and Some(_) for Icac / Noc.
signing_key is the issuer’s private key — the RCAC’s own key
for RCAC and ICAC; the ICAC’s (or RCAC’s) for NOC.
Auto Trait Implementations§
impl<'a> !UnwindSafe for CertGenerator<'a>
impl<'a> Freeze for CertGenerator<'a>
impl<'a> RefUnwindSafe for CertGenerator<'a>
impl<'a> Send for CertGenerator<'a>
impl<'a> Sync for CertGenerator<'a>
impl<'a> Unpin for CertGenerator<'a>
impl<'a> UnsafeUnpin for CertGenerator<'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
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> ⓘ
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> ⓘ
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 more