Struct include_crypt::EncryptedFile [−][src]
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 theencrypt_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]
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
impl RefUnwindSafe for EncryptedFile
[src]
impl Send for EncryptedFile
[src]
impl Sync for EncryptedFile
[src]
impl Unpin for EncryptedFile
[src]
impl UnwindSafe for EncryptedFile
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,