pub struct EncryptedFile<R> { /* private fields */ }Expand description
An encrypted file.
Implementations§
Source§impl<R> EncryptedFile<R>
impl<R> EncryptedFile<R>
Sourcepub fn new(reader: R) -> Result<Self, Error>
pub fn new(reader: R) -> Result<Self, Error>
Opens reader as an encrypted file.
This reads enough of the file to verify that it is in the expected format and returns an error if it cannot be read or is not the expected format.
reader doesn’t need to be BufRead, and probably should not be. The
EncryptedReader returned by unlock or unlock_literal will be
BufRead.
Sourcepub fn unlock<P>(self, password: P) -> Result<EncryptedReader<R>, Self>
pub fn unlock<P>(self, password: P) -> Result<EncryptedReader<R>, Self>
Tries to unlock the encrypted file using both password and with
password decoded with EncodedPassword::decode. If successful,
returns an EncryptedReader for the file; on failure, returns the
EncryptedFile again for another try.
Sourcepub fn unlock_literal<P>(self, password: P) -> Result<EncryptedReader<R>, Self>
pub fn unlock_literal<P>(self, password: P) -> Result<EncryptedReader<R>, Self>
Tries to unlock the encrypted file using just password. If
successful, returns an EncryptedReader for the file; on failure,
returns the EncryptedFile again for another try.
If the password itself might be encoded (“encrypted”), instead use Self::unlock to try it both ways.
Trait Implementations§
Source§impl<R: Clone> Clone for EncryptedFile<R>
impl<R: Clone> Clone for EncryptedFile<R>
Source§fn clone(&self) -> EncryptedFile<R>
fn clone(&self) -> EncryptedFile<R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<R> Freeze for EncryptedFile<R>where
R: Freeze,
impl<R> RefUnwindSafe for EncryptedFile<R>where
R: RefUnwindSafe,
impl<R> Send for EncryptedFile<R>where
R: Send,
impl<R> Sync for EncryptedFile<R>where
R: Sync,
impl<R> Unpin for EncryptedFile<R>where
R: Unpin,
impl<R> UnsafeUnpin for EncryptedFile<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for EncryptedFile<R>where
R: UnwindSafe,
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
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> ⓘ
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> ⓘ
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