Struct include_crypt::EncryptedFile[][src]

pub struct EncryptedFile { /* fields omitted */ }
Expand description

The structure which is used to store the encrypted buffer and the decryption keys.

Implementations

impl EncryptedFile[src]

pub const fn new(buffer: &'static [u8], enc_type: EncryptionType) -> Self[src]

Creates a new instance with the specified encrypted buffer and encryption type. The encryption type also stores the decryption keys which can be used to access the original data.

Parameters

  • buffer: The buffer with the encrypted bytes. This will be the output of the encrypt_xor / encrypt_aes proc macros.
  • enc_type: The type of the encryption. This will be used to decrypt the buffer as it also stores the decryption keys for the different algorithms. If the key is randomly generated it will also be returned by the proc macro and saved.

Returns

Returns a EncryptedFile instance which can be used to decrypt the internal buffer.

pub fn decrypt(&self) -> Vec<u8>[src]

Decrypts the internal buffer and returns it.

Returns

Returns the decrypted buffer.

pub fn decrypt_str(&self) -> Result<String, FromUtf8Error>[src]

Decrypts the internal buffer and returns it as a string.

Returns

If the decrypted buffer is not a valid utf-8 string, an error will be returned. If it is a valid utf-8 string, it will be returned.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V