pub trait PlainMessageSharedKeyCore {
type R: RngSingleton;
fn new(plain_message: Vec<u8>) -> Self
where
Self: Sized;
fn into_vec(self) -> Vec<u8>;
fn as_slice(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
fn encrypt<S>(&self, shared_key: &S) -> Result<EncryptedMessage, Error>
where
S: AsSharedKey,
{ ... }
fn decrypt<S>(
encrypted_message: &EncryptedMessage,
shared_key: &S
) -> Result<Self, Error>
where
Self: Sized,
S: AsSharedKey,
{ ... }
fn generate_nonce() -> XNonce { ... }
}
Expand description
Plain message structure serialized via serde.
Required Associated Types
type R: RngSingleton
type R: RngSingleton
RNG singleton
Required Methods
Provided Methods
fn encrypt<S>(&self, shared_key: &S) -> Result<EncryptedMessage, Error> where
S: AsSharedKey,
fn encrypt<S>(&self, shared_key: &S) -> Result<EncryptedMessage, Error> where
S: AsSharedKey,
Encrypt into EncryptedMessage
fn decrypt<S>(
encrypted_message: &EncryptedMessage,
shared_key: &S
) -> Result<Self, Error> where
Self: Sized,
S: AsSharedKey,
fn decrypt<S>(
encrypted_message: &EncryptedMessage,
shared_key: &S
) -> Result<Self, Error> where
Self: Sized,
S: AsSharedKey,
Decrypt from EncryptedMessage
fn generate_nonce() -> XNonce
fn generate_nonce() -> XNonce
Generate random nonce which is large enough (24-byte) to rarely conflict.