pub struct EncryptedMessage { /* private fields */ }
Expand description
Encrypted message structure.
This struct is serialized into Vec<u8>
(and deserialized from Vec<u8>
).
In order to send an EncryptedMessage to a remote receiver, use let bin = encrypted_message.serialize();
.
Then, the receiver should deserialize it by let encrypted_message = EncryptedMessage::deserialize(bin);
.
This struct includes Nonce, which is internally used when a receiver decrypt the encrypted message.
Implementations§
Source§impl EncryptedMessage
impl EncryptedMessage
Sourcepub fn serialize(self) -> Vec<u8> ⓘ
pub fn serialize(self) -> Vec<u8> ⓘ
Serialize this encrypted message into binary in order to send it to a remote receiver.
Sourcepub fn deserialize(
serialized_encrypted_message: Vec<u8>,
) -> Result<EncryptedMessage, Error>
pub fn deserialize( serialized_encrypted_message: Vec<u8>, ) -> Result<EncryptedMessage, Error>
Deserializer function for a receiver.
§Failures
- DeserializationError when:
- binary data does not have nonce.
Trait Implementations§
Source§impl Clone for EncryptedMessage
impl Clone for EncryptedMessage
Source§fn clone(&self) -> EncryptedMessage
fn clone(&self) -> EncryptedMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for EncryptedMessage
impl Debug for EncryptedMessage
Source§impl PartialEq for EncryptedMessage
impl PartialEq for EncryptedMessage
impl Eq for EncryptedMessage
impl StructuralPartialEq for EncryptedMessage
Auto Trait Implementations§
impl Freeze for EncryptedMessage
impl RefUnwindSafe for EncryptedMessage
impl Send for EncryptedMessage
impl Sync for EncryptedMessage
impl Unpin for EncryptedMessage
impl UnwindSafe for EncryptedMessage
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