pub(crate) struct XChaCha20Poly1305;Expand description
XChaCha20-Poly1305 authenticated encryption with associated data.
See the module documentation for the security caveats (no key-commitment) that apply to this cipher.
Trait Implementations§
Source§impl Aead for XChaCha20Poly1305
impl Aead for XChaCha20Poly1305
Source§type Ciphertext = XChaCha20Poly1305Ciphertext
type Ciphertext = XChaCha20Poly1305Ciphertext
Authenticated ciphertext (the encrypted bytes). The nonce is tracked separately, by the
caller.
Source§type Nonce = XChaCha20Poly1305Nonce
type Nonce = XChaCha20Poly1305Nonce
The per-message nonce. A fresh nonce must be supplied for every encryption under a given
key.
Source§impl CoseEncryptCipher for XChaCha20Poly1305
impl CoseEncryptCipher for XChaCha20Poly1305
Source§const COSE_ALGORITHM: Algorithm
const COSE_ALGORITHM: Algorithm
The COSE algorithm identifier for this content-encryption cipher. It is written to the
protected header by the
encrypt_* methods and validated by the decrypt_* methods.Source§fn encrypt_cose(
builder: CoseEncryptBuilder,
protected_header: Header,
plaintext: &[u8],
cek: &Self::Key,
) -> CoseEncrypt
fn encrypt_cose( builder: CoseEncryptBuilder, protected_header: Header, plaintext: &[u8], cek: &Self::Key, ) -> CoseEncrypt
Encrypts
plaintext under cek into a [CoseEncrypt], declaring
COSE_ALGORITHM in the (authenticated) protected header and storing
the freshly generated nonce in the unprotected iv header. Read moreSource§fn decrypt_cose(
cose_encrypt: &CoseEncrypt,
cek: &Self::Key,
) -> Result<Vec<u8>, CryptoError>
fn decrypt_cose( cose_encrypt: &CoseEncrypt, cek: &Self::Key, ) -> Result<Vec<u8>, CryptoError>
Authenticates and decrypts the ciphertext of
cose_encrypt under cek, reading the nonce
from the unprotected iv header. Read moreSource§fn encrypt_cose0(
builder: CoseEncrypt0Builder,
protected_header: Header,
plaintext: &[u8],
cek: &Self::Key,
) -> CoseEncrypt0
fn encrypt_cose0( builder: CoseEncrypt0Builder, protected_header: Header, plaintext: &[u8], cek: &Self::Key, ) -> CoseEncrypt0
Encrypts
plaintext under cek into a [CoseEncrypt0]. Behaves like
encrypt_cose, but produces a single-recipient message.Source§fn decrypt_cose0(
cose_encrypt0: &CoseEncrypt0,
cek: &Self::Key,
) -> Result<Vec<u8>, CryptoError>
fn decrypt_cose0( cose_encrypt0: &CoseEncrypt0, cek: &Self::Key, ) -> Result<Vec<u8>, CryptoError>
Authenticates and decrypts the ciphertext of
cose_encrypt0 under cek. Behaves like
decrypt_cose, but for a single-recipient message.Auto Trait Implementations§
impl Freeze for XChaCha20Poly1305
impl RefUnwindSafe for XChaCha20Poly1305
impl Send for XChaCha20Poly1305
impl Sync for XChaCha20Poly1305
impl Unpin for XChaCha20Poly1305
impl UnsafeUnpin for XChaCha20Poly1305
impl UnwindSafe for XChaCha20Poly1305
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more