Skip to main content

DevelopmentChain

Struct DevelopmentChain 

Source
pub struct DevelopmentChain { /* private fields */ }
Available on crate feature rustcrypto only.
Expand description

A development attestation authority.

Holds a key handle, never a key — the same argument as CertAuthority: a factory that keeps its PAA in an HSM and a test that keeps it in RAM run the same code.

Implementations§

Source§

impl DevelopmentChain

Source

pub const fn new(not_before: u32, years: u32) -> Self

A chain for TEST_VENDOR_ID, valid from not_before for years.

Source

pub fn for_vendor(self, vendor_id: VendorId) -> Result<Self>

The same chain for a different vendor id.

Anything outside 0xFFF1–0xFFF4 is refused: a development chain claiming a real vendor’s id is a forgery, however well-intentioned, and §6.2.2 gives a commissioner no way to tell the two apart except the id.

Source

pub const fn vendor_id(&self) -> VendorId

The vendor id this chain attests to.

Source

pub fn paa<'b, K: KeyStore>( &self, keys: &K, buf: &'b mut [u8], key: KeyHandle, ) -> Result<&'b [u8]>

Writes a self-signed Product Attestation Authority certificate into buf.

§6.2.2.4 rule 2: a PAA is a CA. verify_dac_chain additionally requires its path-length constraint to be absent or exactly 1 — one intermediate between it and a DAC, which is the shape §6.2.2 defines and no other.

Source

pub fn pai<'b, K: KeyStore>( &self, keys: &K, buf: &'b mut [u8], paa_key: KeyHandle, pai_public: &PublicKey, ) -> Result<&'b [u8]>

Writes a Product Attestation Intermediate certificate into buf.

§6.2.2.4 rule 5 puts the vendor id in the subject and rule 3 fixes the path length at 0: a PAI signs DACs and nothing else.

Source

pub fn dac<'b, K: KeyStore>( &self, keys: &K, buf: &'b mut [u8], pai_key: KeyHandle, dac_public: &PublicKey, product_id: u16, ) -> Result<&'b [u8]>

Writes a Device Attestation Certificate into buf.

§6.2.2.4 rule 8 and 9: the subject carries exactly one vendor id and exactly one product id, and rule 8a makes the vendor id match the issuer’s — which is why the PAI’s own name is rebuilt here from the same vendor_id rather than passed in.

Trait Implementations§

Source§

impl Clone for DevelopmentChain

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DevelopmentChain

Source§

impl Debug for DevelopmentChain

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.