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]
impl EncryptedFile
[src]pub const fn new(buffer: &'static [u8], enc_type: EncryptionType) -> Self
[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_str(&self) -> Result<String, FromUtf8Error>
[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
impl Send for EncryptedFile
impl Sync for EncryptedFile
impl Unpin for EncryptedFile
impl UnwindSafe for EncryptedFile
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,