pub struct AesWriter<E: BlockEncryptor, W: Write> {
pub enc: CbcEncryptor<E, EncPadding<PkcsPadding>>,
/* private fields */
}Fields§
§enc: CbcEncryptor<E, EncPadding<PkcsPadding>>Encryptor to encrypt data with
Implementations§
Source§impl<E: BlockEncryptor, W: Write> AesWriter<E, W>
If you don’t want the header you can use this initializer
impl<E: BlockEncryptor, W: Write> AesWriter<E, W>
If you don’t want the header you can use this initializer
pub fn new(iv: Vec<u8>, writer: W, enc: E) -> Result<AesWriter<E, W>>
Sourcepub fn new_with_infos(
iv: Vec<u8>,
infos: CryptoInfo,
writer: W,
enc: E,
) -> Result<AesWriter<E, W>>
pub fn new_with_infos( iv: Vec<u8>, infos: CryptoInfo, writer: W, enc: E, ) -> Result<AesWriter<E, W>>
Initializer that will store info in the file. You muse use the AesReader::new_with_info to decrypt this kind of file
pub fn write_direct(&mut self, buf: &[u8]) -> Result<usize>
Trait Implementations§
Source§impl<E: BlockEncryptor, W: Write> Write for AesWriter<E, W>
impl<E: BlockEncryptor, W: Write> Write for AesWriter<E, W>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Encrypts the passed buffer and writes the result to the underlying writer.
Due to the blocksize of CBC not all data will be written instantaneously. For example if 17 bytes are passed, the first 16 will be encrypted as one block and written the underlying writer, but the last byte won’t be encrypted and written yet.
If flush has been called, this method will always return an error.
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](https://doc.rust-lang.org/nightly/|_| std/io/trait.Write.html#tymethod.flush)
Warning: When this method is called, the encryption will finish and insert final padding.
After calling flush, this writer cannot be written to anymore and will always return an
error.
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)