[][src]Enum magic_crypt::MagicCrypt

pub enum MagicCrypt {
    AES(MagicCryptAES),
    DES(MagicCryptDES),
}

This enum of structs can help you encrypt or decrypt data in a quick way.

Variants

Methods

impl MagicCrypt[src]

pub fn new<S: AsRef<str>, V: AsRef<str>>(
    key: S,
    bit: SecureBit,
    iv: Option<V>
) -> MagicCrypt
[src]

Create a new MagicCrypt instance. You may want to use new_magic_crypt! macro.

pub fn encrypt_str_to_base64<S: AsRef<str>>(&mut self, string: S) -> String[src]

pub fn encrypt_str_to_bytes<S: AsRef<str>>(&mut self, string: S) -> Vec<u8>[src]

pub fn encrypt_bytes_to_base64<T: ?Sized + AsRef<[u8]>>(
    &mut self,
    bytes: &T
) -> String
[src]

pub fn encrypt_bytes_to_bytes<T: ?Sized + AsRef<[u8]>>(
    &mut self,
    bytes: &T
) -> Vec<u8>
[src]

pub fn encrypt_to_base64<T: ?Sized + AsRef<[u8]>>(&mut self, data: &T) -> String[src]

pub fn encrypt_to_bytes<T: ?Sized + AsRef<[u8]>>(&mut self, data: &T) -> Vec<u8>[src]

pub fn encrypt_reader_to_base64(
    &mut self,
    reader: &mut dyn Read
) -> Result<String, Error>
[src]

pub fn encrypt_reader_to_bytes(
    &mut self,
    reader: &mut dyn Read
) -> Result<Vec<u8>, Error>
[src]

pub fn encrypt_reader_to_writer(
    &mut self,
    reader: &mut dyn Read,
    writer: &mut dyn Write
) -> Result<(), Error>
[src]

pub fn decrypt_base64_to_string<S: AsRef<str>>(
    &mut self,
    base64: S
) -> Result<String, Error>
[src]

pub fn decrypt_base64_to_bytes<S: AsRef<str>>(
    &mut self,
    base64: S
) -> Result<Vec<u8>, Error>
[src]

pub fn decrypt_bytes_to_string<T: ?Sized + AsRef<[u8]>>(
    &mut self,
    bytes: &T
) -> Result<String, Error>
[src]

pub fn decrypt_bytes_to_bytes<T: ?Sized + AsRef<[u8]>>(
    &mut self,
    bytes: &T
) -> Result<Vec<u8>, Error>
[src]

pub fn decrypt_reader_to_bytes(
    &mut self,
    reader: &mut dyn Read
) -> Result<Vec<u8>, Error>
[src]

pub fn decrypt_reader_to_writer(
    &mut self,
    reader: &mut dyn Read,
    writer: &mut dyn Write
) -> Result<(), Error>
[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.

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.