pub struct PZip { /* private fields */ }
Expand description
Structure for holding information about a PZip archive, and a namespace for common operations.
Implementations§
Source§impl PZip
impl PZip
Sourcepub fn reader<'r, T: Read>(
reader: &'r mut T,
key_material: &[u8],
) -> Result<PZipReader<'r, T>, Error>
pub fn reader<'r, T: Read>( reader: &'r mut T, key_material: &[u8], ) -> Result<PZipReader<'r, T>, Error>
Returns a PZipReader
after reading the PZip header and tag data.
This method first reads the PZip header and does some validation. So in addition
to Error::IoError
caused by read failures, it may also return
Error::IncorrectMagic
if the file magic is incorrect, or
Error::UnknownVersion
if an unknown version is specified. Any of the other
Unknown*
errors may also be returned when trying to parse the algorithm, KDF,
compression method, or tags.
Sourcepub fn writer<'r, T: Write, K: PZipKey>(
writer: &'r mut T,
algorithm: Algorithm,
key: &K,
compression: Compression,
) -> Result<PZipWriter<'r, T>, Error>
pub fn writer<'r, T: Write, K: PZipKey>( writer: &'r mut T, algorithm: Algorithm, key: &K, compression: Compression, ) -> Result<PZipWriter<'r, T>, Error>
Returns a PZipWriter
with the specified algorithm, key, and compression.
Sourcepub fn decrypt(ciphertext: &[u8], key_material: &[u8]) -> Result<Vec<u8>, Error>
pub fn decrypt(ciphertext: &[u8], key_material: &[u8]) -> Result<Vec<u8>, Error>
One-shot decryption.
Sourcepub fn decrypt_to<R: Read, W: Write>(
input: &mut R,
output: &mut W,
key_material: &[u8],
) -> Result<usize, Error>
pub fn decrypt_to<R: Read, W: Write>( input: &mut R, output: &mut W, key_material: &[u8], ) -> Result<usize, Error>
Streaming decryption.
Auto Trait Implementations§
impl Freeze for PZip
impl RefUnwindSafe for PZip
impl Send for PZip
impl Sync for PZip
impl Unpin for PZip
impl UnwindSafe for PZip
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
Mutably borrows from an owned value. Read more