Struct bc_components::EncryptedMessage
source · pub struct EncryptedMessage { /* private fields */ }
Expand description
A secure encrypted message.
Implemented using the IETF ChaCha20-Poly1305 encryption.
https://datatracker.ietf.org/doc/html/rfc8439
To facilitate decoding, it is recommended that the plaintext of an EncryptedMessage
be
tagged CBOR.
Implementations§
source§impl EncryptedMessage
impl EncryptedMessage
sourcepub fn new(
ciphertext: Vec<u8>,
aad: Vec<u8>,
nonce: Nonce,
auth: AuthenticationTag
) -> Self
pub fn new( ciphertext: Vec<u8>, aad: Vec<u8>, nonce: Nonce, auth: AuthenticationTag ) -> Self
Restores an EncryptedMessage from its CBOR representation.
This is a low-level function that is not normally needed.
sourcepub fn ciphertext(&self) -> &[u8] ⓘ
pub fn ciphertext(&self) -> &[u8] ⓘ
Returns a reference to the ciphertext data.
sourcepub fn authentication_tag(&self) -> &AuthenticationTag
pub fn authentication_tag(&self) -> &AuthenticationTag
Returns a reference to the authentication tag value used for encryption.
sourcepub fn opt_digest(&self) -> Option<Digest>
pub fn opt_digest(&self) -> Option<Digest>
Returns an optional Digest
instance if the AAD data can be parsed as CBOR.
sourcepub fn has_digest(&self) -> bool
pub fn has_digest(&self) -> bool
Returns true
if the AAD data can be parsed as CBOR.
Trait Implementations§
source§impl CBORDecodable for EncryptedMessage
impl CBORDecodable for EncryptedMessage
source§impl CBOREncodable for EncryptedMessage
impl CBOREncodable for EncryptedMessage
source§impl CBORTagged for EncryptedMessage
impl CBORTagged for EncryptedMessage
source§impl CBORTaggedDecodable for EncryptedMessage
impl CBORTaggedDecodable for EncryptedMessage
source§fn from_untagged_cbor(cbor: &CBOR) -> Result<Self, Error>
fn from_untagged_cbor(cbor: &CBOR) -> Result<Self, Error>
Creates an instance of this type by decoding it from untagged CBOR.
source§fn from_tagged_cbor(cbor: &CBOR) -> Result<Self, Error>where
Self: Sized,
fn from_tagged_cbor(cbor: &CBOR) -> Result<Self, Error>where Self: Sized,
Creates an instance of this type by decoding it from tagged CBOR.
source§impl CBORTaggedEncodable for EncryptedMessage
impl CBORTaggedEncodable for EncryptedMessage
source§fn untagged_cbor(&self) -> CBOR
fn untagged_cbor(&self) -> CBOR
Returns the untagged CBOR encoding of this instance.
source§fn tagged_cbor(&self) -> CBOR
fn tagged_cbor(&self) -> CBOR
Returns the tagged CBOR encoding of this instance.
source§impl Clone for EncryptedMessage
impl Clone for EncryptedMessage
source§fn clone(&self) -> EncryptedMessage
fn clone(&self) -> EncryptedMessage
Returns a copy 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 DigestProvider for EncryptedMessage
impl DigestProvider for EncryptedMessage
source§impl PartialEq<EncryptedMessage> for EncryptedMessage
impl PartialEq<EncryptedMessage> for EncryptedMessage
source§fn eq(&self, other: &EncryptedMessage) -> bool
fn eq(&self, other: &EncryptedMessage) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl URDecodable for EncryptedMessage
impl URDecodable for EncryptedMessage
source§impl UREncodable for EncryptedMessage
impl UREncodable for EncryptedMessage
impl CBORCodable for EncryptedMessage
impl CBORTaggedCodable for EncryptedMessage
impl Eq for EncryptedMessage
impl StructuralEq for EncryptedMessage
impl StructuralPartialEq for EncryptedMessage
impl URCodable for EncryptedMessage
Auto Trait Implementations§
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