use crate::{IvParams, KeyParams};
use alloc::vec::Vec;
use tc_zeroize::{Zeroize, ZeroizeOnDrop};
pub struct KeyWithIvOwned {
key: Vec<u8>,
iv: Vec<u8>,
}
impl KeyWithIvOwned {
pub const fn new(key: Vec<u8>, iv: Vec<u8>) -> Self {
Self { key, iv }
}
}
impl KeyParams for KeyWithIvOwned {
fn key(&self) -> &[u8] {
&self.key
}
}
impl IvParams for KeyWithIvOwned {
fn iv(&self) -> &[u8] {
&self.iv
}
}
impl Zeroize for KeyWithIvOwned {
fn zeroize(&mut self) {
self.key.zeroize();
self.iv.zeroize();
}
}
impl Drop for KeyWithIvOwned {
fn drop(&mut self) {
self.zeroize();
}
}
impl ZeroizeOnDrop for KeyWithIvOwned {}