[][src]Struct asuran::repository::Key

pub struct Key {
    key: Vec<u8>,
    hmac_key: Vec<u8>,
    id_key: Vec<u8>,
    chunker_nonce: u64,
}

Stores the Key material used by an asuran repository.

Contains 5 separate pieces of key material:

The key used for encryption/decryption operations

The key used for generating the integrity validation HMAC tag

The key used for ChunkID generation using the HMAC

A random u64 used for chunker randomization with supported chunking algorithms

Fields

key: Vec<u8>hmac_key: Vec<u8>id_key: Vec<u8>chunker_nonce: u64

Methods

impl Key[src]

pub fn from_bytes(bytes: &[u8], chunker_nonce: u64) -> Key[src]

Creates a key from the given array of bytes

Will split the key stream into thirds.

Does not perform any padding.

pub fn random(length: usize) -> Key[src]

Securely generates a random bundle of key material

Takes the desired length in bytes of each individual key component

pub fn key(&self) -> &[u8][src]

Obtains a reference to the key bytes

pub fn hmac_key(&self) -> &[u8][src]

Obtains a reference to the HMAC key bytes

pub fn id_key(&self) -> &[u8][src]

Obtains a reference to the ID key bytes

pub fn chunker_nonce(&self) -> u64[src]

Obtains the chunker nonce

Trait Implementations

impl Clone for Key[src]

impl Debug for Key[src]

impl<'de> Deserialize<'de> for Key[src]

impl Drop for Key[src]

impl Eq for Key[src]

impl PartialEq<Key> for Key[src]

impl Serialize for Key[src]

impl StructuralEq for Key[src]

impl StructuralPartialEq for Key[src]

impl Zeroize for Key[src]

Auto Trait Implementations

impl RefUnwindSafe for Key

impl Send for Key

impl Sync for Key

impl Unpin for Key

impl UnwindSafe for Key

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]

impl<Z> Zeroize for Z where
    Z: DefaultIsZeroes
[src]