pub struct KeyRing { /* private fields */ }Expand description
A key ring holding master and session keys.
Implementations§
Source§impl KeyRing
impl KeyRing
Sourcepub fn load(&mut self, key_id: u16, material: &[u8]) -> Result<(), Error>
pub fn load(&mut self, key_id: u16, material: &[u8]) -> Result<(), Error>
Loads a key into the ring in PREACTIVE state.
Sourcepub fn find(&self, key_id: u16) -> Option<&ManagedKey>
pub fn find(&self, key_id: u16) -> Option<&ManagedKey>
Finds a key by ID.
Sourcepub fn find_mut(&mut self, key_id: u16) -> Option<&mut ManagedKey>
pub fn find_mut(&mut self, key_id: u16) -> Option<&mut ManagedKey>
Finds a key by ID (mutable).
Sourcepub fn otar(
&mut self,
master_key_id: u16,
iv: &[u8],
encrypted_block: &mut [u8],
tag: &[u8],
crypto: &impl CryptoProvider,
sa: &SecurityAssociation,
) -> Result<usize, Error>
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.
Sourcepub fn inventory(&self) -> impl Iterator<Item = (u16, KeyState)> + '_
pub fn inventory(&self) -> impl Iterator<Item = (u16, KeyState)> + '_
Returns an iterator over all keys for inventory queries.
Sourcepub 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>
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§
impl Freeze for KeyRing
impl RefUnwindSafe for KeyRing
impl Send for KeyRing
impl Sync for KeyRing
impl Unpin for KeyRing
impl UnsafeUnpin for KeyRing
impl UnwindSafe for KeyRing
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