pub struct Encryptor { /* private fields */ }Expand description
Encryptor for creating an age file.
Implementations§
Source§impl Encryptor
impl Encryptor
Sourcepub fn with_recipients<'a>(
recipients: impl Iterator<Item = &'a dyn Recipient>,
) -> Result<Encryptor, EncryptError>
pub fn with_recipients<'a>( recipients: impl Iterator<Item = &'a dyn Recipient>, ) -> Result<Encryptor, EncryptError>
Constructs an Encryptor that will create an age file encrypted to a list of
recipients.
Sourcepub fn wrap_output<W>(self, output: W) -> Result<StreamWriter<W>, Error>where
W: Write,
pub fn wrap_output<W>(self, output: W) -> Result<StreamWriter<W>, Error>where
W: Write,
Creates a wrapper around a writer that will encrypt its input.
Returns errors from the underlying writer while writing the header.
You MUST call StreamWriter::finish when you are done writing, in order to
finish the encryption process. Failing to call StreamWriter::finish will
result in a truncated file that will fail to decrypt.
Sourcepub async fn wrap_async_output<W>(
self,
output: W,
) -> Result<StreamWriter<W>, Error>where
W: AsyncWrite + Unpin,
pub async fn wrap_async_output<W>(
self,
output: W,
) -> Result<StreamWriter<W>, Error>where
W: AsyncWrite + Unpin,
Creates a wrapper around a writer that will encrypt its input.
Returns errors from the underlying writer while writing the header.
You MUST call AsyncWrite::poll_close when you are done writing, in order
to finish the encryption process. Failing to call AsyncWrite::poll_close
will result in a truncated file that will fail to decrypt.