pub struct AuthenticationTag(/* private fields */);
Expand description
The authentication tag produced by the encryption process to verify message integrity.
An AuthenticationTag
is a 16-byte value generated during ChaCha20-Poly1305
authenticated encryption. It serves as a message authentication code (MAC)
that verifies both the authenticity and integrity of the encrypted message.
During decryption, the tag is verified to ensure:
- The message has not been tampered with (integrity)
- The message was encrypted by someone who possesses the encryption key (authenticity)
This implementation follows the Poly1305 MAC algorithm as specified in RFC-8439.
Implementations§
Source§impl AuthenticationTag
impl AuthenticationTag
pub const AUTHENTICATION_TAG_SIZE: usize = 16usize
Sourcepub const fn from_data(data: [u8; 16]) -> Self
pub const fn from_data(data: [u8; 16]) -> Self
Restore an AuthenticationTag
from a fixed-size array of bytes.
Sourcepub fn from_data_ref(data: impl AsRef<[u8]>) -> Result<Self>
pub fn from_data_ref(data: impl AsRef<[u8]>) -> Result<Self>
Restore an AuthenticationTag
from a reference to an array of bytes.
Trait Implementations§
Source§impl AsRef<[u8]> for AuthenticationTag
impl AsRef<[u8]> for AuthenticationTag
Source§impl AsRef<AuthenticationTag> for AuthenticationTag
Implements AsRef<AuthenticationTag>
to allow self-reference.
impl AsRef<AuthenticationTag> for AuthenticationTag
Implements AsRef<AuthenticationTag>
to allow self-reference.
Source§fn as_ref(&self) -> &AuthenticationTag
fn as_ref(&self) -> &AuthenticationTag
Source§impl Clone for AuthenticationTag
impl Clone for AuthenticationTag
Source§fn clone(&self) -> AuthenticationTag
fn clone(&self) -> AuthenticationTag
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for AuthenticationTag
Implements Debug formatting to display the tag in hexadecimal format.
impl Debug for AuthenticationTag
Implements Debug formatting to display the tag in hexadecimal format.
Source§impl From<&[u8]> for AuthenticationTag
Implements conversion from a byte slice to an AuthenticationTag.
impl From<&[u8]> for AuthenticationTag
Implements conversion from a byte slice to an AuthenticationTag.
Source§impl<'a> From<&'a AuthenticationTag> for &'a [u8; 16]
Implements conversion from an AuthenticationTag reference to a byte array
reference.
impl<'a> From<&'a AuthenticationTag> for &'a [u8; 16]
Implements conversion from an AuthenticationTag reference to a byte array reference.
Source§fn from(value: &'a AuthenticationTag) -> Self
fn from(value: &'a AuthenticationTag) -> Self
Source§impl From<[u8; 16]> for AuthenticationTag
Implements conversion from a fixed-size byte array to an AuthenticationTag.
impl From<[u8; 16]> for AuthenticationTag
Implements conversion from a fixed-size byte array to an AuthenticationTag.
Source§impl From<AuthenticationTag> for CBOR
Implements conversion from AuthenticationTag to CBOR for serialization.
impl From<AuthenticationTag> for CBOR
Implements conversion from AuthenticationTag to CBOR for serialization.
Source§fn from(value: AuthenticationTag) -> Self
fn from(value: AuthenticationTag) -> Self
Source§impl From<Rc<AuthenticationTag>> for AuthenticationTag
Implements conversion from a reference-counted AuthenticationTag to an owned
AuthenticationTag.
impl From<Rc<AuthenticationTag>> for AuthenticationTag
Implements conversion from a reference-counted AuthenticationTag to an owned AuthenticationTag.
Source§fn from(value: Rc<AuthenticationTag>) -> Self
fn from(value: Rc<AuthenticationTag>) -> Self
Source§impl From<Vec<u8>> for AuthenticationTag
Implements conversion from a byte vector to an AuthenticationTag.
impl From<Vec<u8>> for AuthenticationTag
Implements conversion from a byte vector to an AuthenticationTag.
Source§impl PartialEq for AuthenticationTag
impl PartialEq for AuthenticationTag
Source§impl TryFrom<CBOR> for AuthenticationTag
Implements conversion from CBOR to AuthenticationTag for deserialization.
impl TryFrom<CBOR> for AuthenticationTag
Implements conversion from CBOR to AuthenticationTag for deserialization.
impl Eq for AuthenticationTag
impl StructuralPartialEq for AuthenticationTag
Auto Trait Implementations§
impl Freeze for AuthenticationTag
impl RefUnwindSafe for AuthenticationTag
impl Send for AuthenticationTag
impl Sync for AuthenticationTag
impl Unpin for AuthenticationTag
impl UnwindSafe for AuthenticationTag
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
Source§impl<T> CBOREncodable for T
impl<T> CBOREncodable for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)