pub struct HybridHeader {
pub key_algorithm: KeyAlgorithm,
pub encrypted_session_key: Vec<u8>,
pub nonce: [u8; 12],
pub metadata: FileMetadata,
}
Expand description
Hybrid encryption header containing encrypted session key and metadata
Fields§
§key_algorithm: KeyAlgorithm
Algorithm used for session key encryption
encrypted_session_key: Vec<u8>
Encrypted session key
nonce: [u8; 12]
Nonce for AES-GCM encryption
metadata: FileMetadata
File metadata
Implementations§
Source§impl HybridHeader
impl HybridHeader
Sourcepub fn new(
key_algorithm: KeyAlgorithm,
encrypted_session_key: Vec<u8>,
nonce: [u8; 12],
metadata: FileMetadata,
) -> Self
pub fn new( key_algorithm: KeyAlgorithm, encrypted_session_key: Vec<u8>, nonce: [u8; 12], metadata: FileMetadata, ) -> Self
Create a new hybrid header
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<(Self, usize), HybridCryptoError>
pub fn from_bytes(bytes: &[u8]) -> Result<(Self, usize), HybridCryptoError>
Deserialize header from bytes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HybridHeader
impl RefUnwindSafe for HybridHeader
impl Send for HybridHeader
impl Sync for HybridHeader
impl Unpin for HybridHeader
impl UnwindSafe for HybridHeader
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more