pub struct EncryptionHeader { /* private fields */ }Expand description
The encryption header contains all informations (and the encrypted key) for the data and header encryption.
The encryption header is the only optional header part of the main header
(With the exception of the PBEHeader, which is, however, part of the EncryptionHeader).
The encryption header contains an encrypted key (encrypted encryption key). This key is encrypted with a password based encryption method,
described by the containing PBEHeader.
This key (decrypted with the appropriate password) is used to decrypt the encrypted data or the optionally encrypted header.
Implementations§
Source§impl EncryptionHeader
impl EncryptionHeader
Sourcepub fn new(
version: u8,
pbe_header: PBEHeader,
algorithm: EncryptionAlgorithm,
encrypted_encryption_key: Vec<u8>,
encrypted_header_nonce: [u8; 12],
) -> EncryptionHeader
pub fn new( version: u8, pbe_header: PBEHeader, algorithm: EncryptionAlgorithm, encrypted_encryption_key: Vec<u8>, encrypted_header_nonce: [u8; 12], ) -> EncryptionHeader
creates a new encryption header by the given values.
Sourcepub fn algorithm(&self) -> &EncryptionAlgorithm
pub fn algorithm(&self) -> &EncryptionAlgorithm
returns the used encryption algorithm as a reference.
Sourcepub fn pbe_header(&self) -> &PBEHeader
pub fn pbe_header(&self) -> &PBEHeader
returns a reference to the inner PBE header.
Trait Implementations§
Source§impl Clone for EncryptionHeader
impl Clone for EncryptionHeader
Source§fn clone(&self) -> EncryptionHeader
fn clone(&self) -> EncryptionHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EncryptionHeader
impl Debug for EncryptionHeader
Source§impl HeaderCoding for EncryptionHeader
impl HeaderCoding for EncryptionHeader
Source§type Item = EncryptionHeader
type Item = EncryptionHeader
the return value for decode_content(), decode_directly(), decode_for_key();
Source§fn identifier() -> u32
fn identifier() -> u32
returns the identifier (=Magic bytes) of the header.
Source§fn decode_content(data: Vec<u8>) -> Result<EncryptionHeader>
fn decode_content(data: Vec<u8>) -> Result<EncryptionHeader>
decodes the content of the header.
Source§fn header_size(&self) -> usize
fn header_size(&self) -> usize
returns the size of the encoded header (in bytes)
Source§fn encode_directly(&self) -> Vec<u8> ⓘ
fn encode_directly(&self) -> Vec<u8> ⓘ
encodes the (header) value/object directly (= without key).
Source§fn encode_for_key<K: Into<String>>(&self, key: K) -> Vec<u8> ⓘ
fn encode_for_key<K: Into<String>>(&self, key: K) -> Vec<u8> ⓘ
encodes a key to the (header) value/object.
Source§fn decode_header_length<R: Read>(data: &mut R) -> Result<u64>
fn decode_header_length<R: Read>(data: &mut R) -> Result<u64>
decodes the length of the header.
Source§fn check_identifier<R: Read>(data: &mut R) -> bool
fn check_identifier<R: Read>(data: &mut R) -> bool
checks if the read identifier is valid for this header.
Source§impl PartialEq for EncryptionHeader
impl PartialEq for EncryptionHeader
impl Eq for EncryptionHeader
impl StructuralPartialEq for EncryptionHeader
Auto Trait Implementations§
impl Freeze for EncryptionHeader
impl RefUnwindSafe for EncryptionHeader
impl Send for EncryptionHeader
impl Sync for EncryptionHeader
impl Unpin for EncryptionHeader
impl UnwindSafe for EncryptionHeader
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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