pub struct Keys {
pub encryption_key: [u8; 32],
pub integrity_key: [u8; 32],
}Expand description
Holds the encryption and integrity keys.
Both keys must be exactly 32 bytes (256 bits).
§Fields
encryption_key- AES-256 encryption keyintegrity_key- HMAC-SHA256 integrity key
Fields§
§encryption_key: [u8; 32]AES-256 encryption key (32 bytes)
integrity_key: [u8; 32]HMAC-SHA256 integrity key (32 bytes)
Implementations§
Source§impl Keys
impl Keys
Sourcepub fn new(
encryption_key: &[u8],
integrity_key: &[u8],
) -> Result<Self, CryptoError>
pub fn new( encryption_key: &[u8], integrity_key: &[u8], ) -> Result<Self, CryptoError>
Creates a new Keys instance from raw byte slices.
Both keys must be exactly 32 bytes.
§Errors
Returns CryptoError::InvalidKey if either key is not 32 bytes.
§Example
use signed_crypto::Keys;
let enc_key = [0u8; 32];
let int_key = [0u8; 32];
let keys = Keys::new(&enc_key, &int_key)?;Trait Implementations§
Auto Trait Implementations§
impl Freeze for Keys
impl RefUnwindSafe for Keys
impl Send for Keys
impl Sync for Keys
impl Unpin for Keys
impl UnsafeUnpin for Keys
impl UnwindSafe for Keys
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