pub struct ChaCha20Poly1305 { /* private fields */ }
Available on crate feature
chacha20poly1305
only.Expand description
OpenSSH variant of ChaCha20Poly1305: chacha20-poly1305@openssh.com
as described in PROTOCOL.chacha20poly1305.
Differences from ChaCha20Poly1305-IETF as described in RFC8439:
- Nonce is 64-bit instead of 96-bit (i.e. uses legacy “djb” ChaCha20 variant).
- The AAD and ciphertext inputs of Poly1305 are not padded.
- The lengths of ciphertext and AAD are not authenticated using Poly1305.
- Maximum supported AAD size is 16.
§Usage notes
- In the context of SSH packet encryption, AAD will be 4 bytes and contain the encrypted length.
- In the context of SSH key encryption, AAD will be empty.
Trait Implementations§
Source§impl AeadCore for ChaCha20Poly1305
impl AeadCore for ChaCha20Poly1305
Source§impl AeadInOut for ChaCha20Poly1305
impl AeadInOut for ChaCha20Poly1305
Source§fn encrypt_inout_detached(
&self,
nonce: &ChaChaNonce,
associated_data: &[u8],
buffer: InOutBuf<'_, '_, u8>,
) -> Result<Tag>
fn encrypt_inout_detached( &self, nonce: &ChaChaNonce, associated_data: &[u8], buffer: InOutBuf<'_, '_, u8>, ) -> Result<Tag>
Encrypt the data in the provided
InOutBuf
, returning the authentication tag.Source§fn decrypt_inout_detached(
&self,
nonce: &ChaChaNonce,
associated_data: &[u8],
buffer: InOutBuf<'_, '_, u8>,
tag: &Tag,
) -> Result<()>
fn decrypt_inout_detached( &self, nonce: &ChaChaNonce, associated_data: &[u8], buffer: InOutBuf<'_, '_, u8>, tag: &Tag, ) -> Result<()>
Decrypt the data in the provided
InOutBuf
, returning an error in the event the
provided authentication tag is invalid for the given ciphertext (i.e. ciphertext
is modified/unauthentic)Source§impl Clone for ChaCha20Poly1305
impl Clone for ChaCha20Poly1305
Source§fn clone(&self) -> ChaCha20Poly1305
fn clone(&self) -> ChaCha20Poly1305
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 Drop for ChaCha20Poly1305
impl Drop for ChaCha20Poly1305
Source§impl KeyInit for ChaCha20Poly1305
impl KeyInit for ChaCha20Poly1305
Source§fn weak_key_test(_key: &Array<u8, Self::KeySize>) -> Result<(), WeakKeyError>
fn weak_key_test(_key: &Array<u8, Self::KeySize>) -> Result<(), WeakKeyError>
Check if the key might be considered weak.
Source§fn new_checked(key: &Array<u8, Self::KeySize>) -> Result<Self, WeakKeyError>
fn new_checked(key: &Array<u8, Self::KeySize>) -> Result<Self, WeakKeyError>
Create new value from fixed size key after checking it for weakness.
Source§fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
Create new value from variable size key.
Source§impl KeySizeUser for ChaCha20Poly1305
impl KeySizeUser for ChaCha20Poly1305
impl ZeroizeOnDrop for ChaCha20Poly1305
Available on crate feature
zeroize
only.Auto Trait Implementations§
impl Freeze for ChaCha20Poly1305
impl RefUnwindSafe for ChaCha20Poly1305
impl Send for ChaCha20Poly1305
impl Sync for ChaCha20Poly1305
impl Unpin for ChaCha20Poly1305
impl UnwindSafe for ChaCha20Poly1305
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