pub struct Decryptor<R> { /* private fields */ }Expand description
Decryptor for an age file.
Implementations§
Source§impl<R> Decryptor<R>where
R: Read,
impl<R> Decryptor<R>where
R: Read,
Sourcepub fn new(input: R) -> Result<Decryptor<R>, DecryptError>
pub fn new(input: R) -> Result<Decryptor<R>, DecryptError>
Attempts to create a decryptor for an age file.
Returns an error if the input does not contain a valid age file.
§Performance
This constructor will work with any type implementing io::Read, and uses a
slower parser and internal buffering to ensure no overreading occurs. Consider
using Decryptor::new_buffered for types implementing std::io::BufRead, which
includes &[u8] slices.
Sourcepub fn decrypt<'a>(
self,
identities: impl Iterator<Item = &'a dyn Identity>,
) -> Result<StreamReader<R>, DecryptError>
pub fn decrypt<'a>( self, identities: impl Iterator<Item = &'a dyn Identity>, ) -> Result<StreamReader<R>, DecryptError>
Attempts to decrypt the age file.
If successful, returns a reader that will provide the plaintext.
Source§impl<R> Decryptor<R>where
R: BufRead,
impl<R> Decryptor<R>where
R: BufRead,
Sourcepub fn new_buffered(input: R) -> Result<Decryptor<R>, DecryptError>
pub fn new_buffered(input: R) -> Result<Decryptor<R>, DecryptError>
Attempts to create a decryptor for an age file.
Returns an error if the input does not contain a valid age file.
§Performance
This constructor is more performant than Decryptor::new for types implementing
io::BufRead, which includes &[u8] slices.
Source§impl<R> Decryptor<R>
impl<R> Decryptor<R>
Sourcepub async fn new_async(input: R) -> Result<Decryptor<R>, DecryptError>
pub async fn new_async(input: R) -> Result<Decryptor<R>, DecryptError>
Attempts to create a decryptor for an age file.
Returns an error if the input does not contain a valid age file.
§Performance
This constructor will work with any type implementing AsyncRead, and uses a
slower parser and internal buffering to ensure no overreading occurs. Consider
using Decryptor::new_async_buffered for types implementing AsyncBufRead,
which includes &[u8] slices.
Sourcepub fn decrypt_async<'a>(
self,
identities: impl Iterator<Item = &'a dyn Identity>,
) -> Result<StreamReader<R>, DecryptError>
pub fn decrypt_async<'a>( self, identities: impl Iterator<Item = &'a dyn Identity>, ) -> Result<StreamReader<R>, DecryptError>
Attempts to decrypt the age file.
If successful, returns a reader that will provide the plaintext.
Source§impl<R> Decryptor<R>where
R: AsyncBufRead + Unpin,
impl<R> Decryptor<R>where
R: AsyncBufRead + Unpin,
Sourcepub async fn new_async_buffered(input: R) -> Result<Decryptor<R>, DecryptError>
pub async fn new_async_buffered(input: R) -> Result<Decryptor<R>, DecryptError>
Attempts to create a decryptor for an age file.
Returns an error if the input does not contain a valid age file.
§Performance
This constructor is more performant than Decryptor::new_async for types
implementing AsyncBufRead, which includes &[u8] slices.