[][src]Struct pwbox::PwBox

pub struct PwBox<K, C> { /* fields omitted */ }

Password-encrypted data.

See also

See the crate docs for an example of usage. See ErasedPwBox for serialization details.

Implementations

impl<K: DeriveKey + Default, C: Cipher> PwBox<K, C>[src]

pub fn new<R: RngCore + CryptoRng>(
    rng: &mut R,
    password: impl AsRef<[u8]>,
    message: impl AsRef<[u8]>
) -> Result<Self>
[src]

Creates a new box by using default settings of the supplied KDF.

impl<K: DeriveKey, C: Cipher> PwBox<K, C>[src]

pub fn len(&self) -> usize[src]

Returns the byte size of the encrypted data stored in this box.

pub fn open_into(
    &self,
    output: impl AsMut<[u8]>,
    password: impl AsRef<[u8]>
) -> Result<(), Error>
[src]

Decrypts the box into the specified container.

This method should be preferred to open() if the output type implements zeroing on drop (e.g., cryptographic secrets from sodiumoxide).

pub fn open(&self, password: impl AsRef<[u8]>) -> Result<SensitiveData, Error>[src]

Decrypts the box and returns its contents. The returned container is zeroed on drop and derefs to a byte slice.

Trait Implementations

impl<K: Debug, C: Debug> Debug for PwBox<K, C>[src]

Auto Trait Implementations

impl<K, C> RefUnwindSafe for PwBox<K, C> where
    C: RefUnwindSafe,
    K: RefUnwindSafe

impl<K, C> Send for PwBox<K, C> where
    C: Send,
    K: Send

impl<K, C> Sync for PwBox<K, C> where
    C: Sync,
    K: Sync

impl<K, C> Unpin for PwBox<K, C> where
    C: Unpin,
    K: Unpin

impl<K, C> UnwindSafe for PwBox<K, C> where
    C: UnwindSafe,
    K: UnwindSafe

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> From<T> 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, 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.