Skip to main content

KeyHeader

Struct KeyHeader 

Source
pub struct KeyHeader {
Show 14 fields pub header_version: u32, pub csp_id: Guid, pub blob_type: KeyBlobType, pub format: u32, pub algorithm_id: u32, pub key_class: KeyClass, pub logical_key_size_in_bits: u32, pub key_attr: u32, pub key_usage: u32, pub start_date: CssmDate, pub end_date: CssmDate, pub wrap_algorithm_id: u32, pub wrap_mode: u32, pub reserved: u32,
}
Expand description

CSSM_KEYHEADER, the 76-byte header of every stored key.

Fields§

§header_version: u32§csp_id: Guid§blob_type: KeyBlobType§format: u32§algorithm_id: u32§key_class: KeyClass§logical_key_size_in_bits: u32§key_attr: u32

CSSM_KEYATTR_FLAGS.

§key_usage: u32

CSSM_KEYUSE.

§start_date: CssmDate§end_date: CssmDate§wrap_algorithm_id: u32§wrap_mode: u32§reserved: u32

Implementations§

Source§

impl KeyHeader

Source

pub const LEN: usize = 76

Source

pub fn parse(data: &[u8]) -> Result<Self>

Source

pub fn write(&self, out: &mut Vec<u8>)

Source

pub fn to_bytes(&self) -> Vec<u8>

Source

pub fn item_key() -> Self

The header macOS writes for a wrapped item key: a 192-bit 3DES session key from the Apple CSP that may only encrypt and decrypt its item.

securityd checks these bits before it will use the key, so they are the values security writes, not a plausible-looking set. key_size_matches_apples_header pins the whole header to a keychain macOS wrote.

Source§

impl KeyHeader

Source

pub fn private_key(key_size_in_bits: u32) -> Self

The header macOS writes for an imported RSA private key.

The bits are the ones security import writes: permanent, sensitive, always sensitive, extractable, and usable for anything.

key_size is recorded in the record’s attributes as well; the header carries the logical size.

Trait Implementations§

Source§

impl Clone for KeyHeader

Source§

fn clone(&self) -> KeyHeader

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 Debug for KeyHeader

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for KeyHeader

Source§

impl PartialEq for KeyHeader

Source§

fn eq(&self, other: &KeyHeader) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for KeyHeader

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = 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>,

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.
Source§

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

Source§

fn vzip(self) -> V