pub enum EncryptionCodec {
XChaCha20Poly1305 {
cipher: XChaCha20Poly1305,
},
}
Expand description
Represents the codec that encodes & decodes frames by encrypting/decrypting them
Variants§
XChaCha20Poly1305
ChaCha20Poly1305 variant with an extended 192-bit (24-byte) nonce, using
[XChaCha20Poly1305
] underneath
Fields
§
cipher: XChaCha20Poly1305
Implementations§
Source§impl EncryptionCodec
impl EncryptionCodec
Sourcepub fn from_type_and_key(
ty: EncryptionType,
key: &[u8],
) -> Result<EncryptionCodec>
pub fn from_type_and_key( ty: EncryptionType, key: &[u8], ) -> Result<EncryptionCodec>
Makes a new EncryptionCodec
based on the EncryptionType
and key
, returning an
error if the key is invalid for the encryption type or the type is unknown
pub fn new_xchacha20poly1305(secret_key: SecretKey32) -> EncryptionCodec
Sourcepub fn ty(&self) -> EncryptionType
pub fn ty(&self) -> EncryptionType
Returns the encryption type associa ted with the codec
Sourcepub const fn nonce_size(&self) -> usize
pub const fn nonce_size(&self) -> usize
Size of nonce (in bytes) associated with the encryption algorithm
Trait Implementations§
Source§impl Clone for EncryptionCodec
impl Clone for EncryptionCodec
Source§fn clone(&self) -> EncryptionCodec
fn clone(&self) -> EncryptionCodec
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 Codec for EncryptionCodec
impl Codec for EncryptionCodec
Auto Trait Implementations§
impl Freeze for EncryptionCodec
impl RefUnwindSafe for EncryptionCodec
impl Send for EncryptionCodec
impl Sync for EncryptionCodec
impl Unpin for EncryptionCodec
impl UnwindSafe for EncryptionCodec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<C> CodecExt for Cwhere
C: Codec,
impl<C> CodecExt for Cwhere
C: Codec,
Source§fn chain<T>(self, codec: T) -> ChainCodec<C, T>
fn chain<T>(self, codec: T) -> ChainCodec<C, T>
Chains this codec with another codec