Struct PZip

Source
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

Source

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.

Source

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.

Source

pub fn decrypt(ciphertext: &[u8], key_material: &[u8]) -> Result<Vec<u8>, Error>

One-shot decryption.

Source

pub fn decrypt_to<R: Read, W: Write>( input: &mut R, output: &mut W, key_material: &[u8], ) -> Result<usize, Error>

Streaming decryption.

Source

pub fn encrypt<K: PZipKey>( plaintext: &[u8], algorithm: Algorithm, key: &K, compression: Compression, ) -> Result<Vec<u8>, Error>

One-shot encryption.

Source

pub fn encrypt_to<R: Read, W: Write, K: PZipKey>( input: &mut R, output: &mut W, algorithm: Algorithm, key: &K, compression: Compression, ) -> Result<usize, Error>

Streaming encryption.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.