pub struct AesGcmSivEncryption { /* private fields */ }Trait Implementations§
Source§impl Encryption for AesGcmSivEncryption
High level encryption functionality for use
in DataVault Implementations
impl Encryption for AesGcmSivEncryption
High level encryption functionality for use in DataVault Implementations
Source§fn new() -> Self
fn new() -> Self
use this struct to add encryption to a data vault
§Example
use data_vault::encryption::traits::Encryption;
use data_vault::encryption::AesGcmSivEncryption;
let enc = AesGcmSivEncryption::new();Source§fn encrypt(&self, bytes: &[u8]) -> Vec<u8> ⓘ
fn encrypt(&self, bytes: &[u8]) -> Vec<u8> ⓘ
The lowest level method for encrypting data.
Encrypts bytes and prepends a 12 byte nonce
to the encrypted data.
§Arguments
bytes - Aata to encrypt
§Example
use data_vault::encryption::traits::Encryption;
use data_vault::encryption::AesGcmSivEncryption;
let enc = AesGcmSivEncryption::new();
let test_data = String::from("Hello world!");
let encrypted_data = enc.encrypt(test_data.as_bytes());Source§fn encrypt_string(&self, text: &String) -> Vec<u8> ⓘ
fn encrypt_string(&self, text: &String) -> Vec<u8> ⓘ
Encrypts String objects.
§Arguments
text: - text data to encrypt
§Example
use data_vault::encryption::traits::Encryption;
use data_vault::encryption::AesGcmSivEncryption;
let enc = AesGcmSivEncryption::new();
let test_data = String::from("Hello world!");
let encrypted_data = enc.encrypt_string(&test_data);Source§fn decrypt(&self, bytes: &[u8]) -> String
fn decrypt(&self, bytes: &[u8]) -> String
The lowest level method to decrypt data
§Arguments
bytes - byte data to decrypt. The first 12 bytes must be a Nonce value
§Example
use data_vault::encryption::traits::Encryption;
use data_vault::encryption::AesGcmSivEncryption;
let enc = AesGcmSivEncryption::new();
let nonce = "unique nonce".as_bytes();
let test_data = vec![85, 117, 109, 67, 71, 109, 74, 66, 55, 100, 119, 70, 208, 88, 64, 198, 33, 160, 61, 101, 8, 179, 140, 90, 139, 124, 195, 110, 120, 216, 244, 143, 128, 208, 90, 61, 127, 37, 35, 235];
let encrypted_data = enc.decrypt_vec(test_data);Source§fn decrypt_vec(&self, cipher_vector: Vec<u8>) -> String
fn decrypt_vec(&self, cipher_vector: Vec<u8>) -> String
decrypts a Vec<u8>
§Arguments
cipher_vector - Vectorized data to decrypt. The first 12 bytes must be a Nonce value.
§Example
use data_vault::encryption::traits::Encryption;
use data_vault::encryption::AesGcmSivEncryption;
let enc = AesGcmSivEncryption::new();
let test_data = vec![85, 117, 109, 67, 71, 109, 74, 66, 55, 100, 119, 70, 208, 88, 64, 198, 33, 160, 61, 101, 8, 179, 140, 90, 139, 124, 195, 110, 120, 216, 244, 143, 128, 208, 90, 61, 127, 37, 35, 235];
let encrypted_data = enc.decrypt(test_data.as_slice());Auto Trait Implementations§
impl Freeze for AesGcmSivEncryption
impl RefUnwindSafe for AesGcmSivEncryption
impl Send for AesGcmSivEncryption
impl Sync for AesGcmSivEncryption
impl Unpin for AesGcmSivEncryption
impl UnwindSafe for AesGcmSivEncryption
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more