Skip to main content

KeyRing

Struct KeyRing 

Source
pub struct KeyRing { /* private fields */ }
Expand description

A key ring holding master and session keys.

Implementations§

Source§

impl KeyRing

Source

pub fn new() -> Self

Creates an empty key ring.

Source

pub fn load(&mut self, key_id: u16, material: &[u8]) -> Result<(), Error>

Loads a key into the ring in PREACTIVE state.

Source

pub fn find(&self, key_id: u16) -> Option<&ManagedKey>

Finds a key by ID.

Source

pub fn find_mut(&mut self, key_id: u16) -> Option<&mut ManagedKey>

Finds a key by ID (mutable).

Source

pub fn activate(&mut self, key_id: u16) -> Result<(), Error>

Activates a key by ID.

Source

pub fn deactivate(&mut self, key_id: u16) -> Result<(), Error>

Deactivates a key by ID.

Source

pub fn destroy(&mut self, key_id: u16) -> Result<(), Error>

Destroys a key by ID.

Source

pub fn otar( &mut self, master_key_id: u16, iv: &[u8], encrypted_block: &mut [u8], tag: &[u8], crypto: &impl CryptoProvider, sa: &SecurityAssociation, ) -> Result<usize, Error>

Processes an OTAR delivery: decrypts session keys using a master key and loads them into the ring.

master_key_id — the key used to decrypt the encrypted key block. iv — initialization vector for decryption. encrypted_block — encrypted payload containing (key_id, key_material) pairs. crypto — cryptographic backend for decryption. sa — security association for the master key context.

Source

pub fn inventory(&self) -> impl Iterator<Item = (u16, KeyState)> + '_

Returns an iterator over all keys for inventory queries.

Source

pub fn verify( &self, key_id: u16, iv: &[u8], challenge: &[u8], response_out: &mut [u8], tag_out: &mut [u8], crypto: &impl CryptoProvider, sa: &SecurityAssociation, ) -> Result<(), Error>

Verifies a key via challenge-response.

Encrypts challenge with the specified key and returns the encrypted result in response_out.

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