Struct crypt_guard::Encrypt

source ·
pub struct Encrypt;

Implementations§

source§

impl Encrypt

source

pub fn new() -> Self

source

pub fn generate_hmac(key: &[u8], data: &[u8]) -> Vec<u8>

source

pub fn append_hmac(encrypted_data: Vec<u8>, hmac: Vec<u8>) -> Vec<u8>

source

pub fn generate_signature(data: &[u8], sk: SecretKey) -> Vec<u8>

source

pub fn append_signature( data: &[u8], signature: Vec<u8> ) -> Result<Vec<u8>, CryptError>

source

pub async fn save_encrypted_message( &self, message: &[u8], path: PathBuf ) -> Result<(), CryptError>

source

pub async fn encrypt( &self, public_key_path: PathBuf, encrypt: &str, action: ActionType, hmac_key: &[u8], nonce: Option<&[u8; 24]> ) -> Result<Vec<u8>, CryptError>

source§

impl Encrypt

source

pub async fn encrypt_data( &self, data: &[u8], key: &[u8], hmac_secret: &[u8] ) -> Result<Vec<u8>, CryptError>

source

pub async fn encrypt_file( &self, file_path: PathBuf, shared_secret: &dyn SharedSecretKem, hmac_key: &[u8] ) -> Result<Vec<u8>, CryptError>

source

pub async fn encrypt_msg( &self, message: &str, shared_secret: &dyn SharedSecretKem, hmac_key: &[u8] ) -> Result<Vec<u8>, CryptError>

source§

impl Encrypt

source

pub async fn encrypt_data_xchacha20( &self, data: &[u8], key: &[u8], nonce: &[u8; 24], hmac_secret: &[u8] ) -> Result<Vec<u8>, CryptError>

source

pub async fn encrypt_file_xchacha20( &self, file_path: PathBuf, shared_secret: &dyn SharedSecretKem, nonce: &[u8; 24], hmac_key: &[u8] ) -> Result<Vec<u8>, CryptError>

source

pub async fn encrypt_msg_xchacha20( &self, message: &str, shared_secret: &dyn SharedSecretKem, nonce: &[u8; 24], hmac_key: &[u8] ) -> Result<Vec<u8>, CryptError>

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V