[][src]Struct asuran::repository::EncryptedKey

pub struct EncryptedKey { /* fields omitted */ }

Stores the key, encrypted with another key derived from the user specified password/passphrase

Uses argon2 to derive the key encryption key from the user supplied key.

Uses a 32 byte salt that is randomly generated

Currently uses semi-arbitrary defaults for some values. TODO: allow configuration of this

Methods

impl EncryptedKey[src]

pub fn encrypt(
    key: &Key,
    mem_cost: u32,
    time_cost: u32,
    encryption: Encryption,
    user_key: &[u8]
) -> EncryptedKey
[src]

Produces an encrypted key from the specified user key and encryption method

pub fn encrypt_defaults(
    key: &Key,
    encryption: Encryption,
    user_key: &[u8]
) -> EncryptedKey
[src]

Convince function that uses argon2 parameters that the author of this program believes are reasonable as of time of writing. Please review them and apply your own common sense before blaming the author for the FBI reading your data.

Parameters are:

  • mem_cost: 65536
  • time_cost: 10

pub fn decrypt(&self, user_key: &[u8]) -> Result<Key, KeyError>[src]

Attempts to decrypt the key material using the user supplied key.

Errors:

Will return Err(KeyError) if key decryption fails

Trait Implementations

impl Clone for EncryptedKey[src]

impl Debug for EncryptedKey[src]

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

impl Serialize for EncryptedKey[src]

Auto Trait Implementations

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: Deserialize<'de>, 
[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]