pub struct SharedKey(/* private fields */);
Expand description
32-byte key shared among sender and receiver secretly.
It is a good practice to use SerdeEncryptPublicKey to exchange this shared key.
Implementations§
Trait Implementations§
Source§fn from_array(key: [u8; 32]) -> Self
fn from_array(key: [u8; 32]) -> Self
Constructor from secret bytes.
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§type S = BincodeSerializer<SharedKey>
type S = BincodeSerializer<SharedKey>
Serializer implementation
Source§fn encrypt(
&self,
combined_key: &SenderCombinedKey<'_, '_>,
) -> Result<EncryptedMessage, Error>where
Self: Serialize,
fn encrypt(
&self,
combined_key: &SenderCombinedKey<'_, '_>,
) -> Result<EncryptedMessage, Error>where
Self: Serialize,
Serialize and encrypt. Read more
Source§fn decrypt_owned(
encrypted_message: &EncryptedMessage,
combined_key: &ReceiverCombinedKey<'_, '_>,
) -> Result<Self, Error>where
Self: DeserializeOwned,
fn decrypt_owned(
encrypted_message: &EncryptedMessage,
combined_key: &ReceiverCombinedKey<'_, '_>,
) -> Result<Self, Error>where
Self: DeserializeOwned,
Decrypt and deserialize into DeserializeOwned type. Read more
Source§fn decrypt_ref<'de>(
encrypted_message: &EncryptedMessage,
combined_key: &ReceiverCombinedKey<'_, '_>,
) -> Result<Self::S, Error>where
Self: Deserialize<'de>,
fn decrypt_ref<'de>(
encrypted_message: &EncryptedMessage,
combined_key: &ReceiverCombinedKey<'_, '_>,
) -> Result<Self::S, Error>where
Self: Deserialize<'de>,
Just decrypts cipher-text. Returned data must be deserialized later.
Types implementing
serde::Deserialize<'de>
(not serde::de::DeserializeOwned
) should use
this function to resolve lifetime. Read moreAuto Trait Implementations§
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