Enum distant_net::common::EncryptionCodec
source · pub enum EncryptionCodec {
XChaCha20Poly1305 {
cipher: XChaCha20Poly1305,
},
}Expand description
Represents the codec that encodes & decodes frames by encrypting/decrypting them
Variants
XChaCha20Poly1305
Fields
cipher: XChaCha20Poly1305ChaCha20Poly1305 variant with an extended 192-bit (24-byte) nonce, using
[XChaCha20Poly1305] underneath
Implementations
sourceimpl 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
sourceimpl Clone for EncryptionCodec
impl Clone for EncryptionCodec
sourcefn clone(&self) -> EncryptionCodec
fn clone(&self) -> EncryptionCodec
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Codec for EncryptionCodec
impl Codec for EncryptionCodec
Auto Trait Implementations
impl RefUnwindSafe for EncryptionCodec
impl Send for EncryptionCodec
impl Sync for EncryptionCodec
impl Unpin for EncryptionCodec
impl UnwindSafe for EncryptionCodec
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more