AesGcmSivEncryption

Struct AesGcmSivEncryption 

Source
pub struct AesGcmSivEncryption { /* private fields */ }

Trait Implementations§

Source§

impl Encryption for AesGcmSivEncryption

High level encryption functionality for use in DataVault Implementations

Source§

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>

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>

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

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

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V