pub struct Encryption { /* private fields */ }
Expand description
Encryption
Implementations§
Source§impl Encryption
impl Encryption
Sourcepub const BLOCK_SIZE: usize = 16usize
pub const BLOCK_SIZE: usize = 16usize
The block size of the encryption algorithm.
Sourcepub fn set_secret(self, secret: Bytes) -> Self
pub fn set_secret(self, secret: Bytes) -> Self
Set the secret used to encrypt/decrypt the encrypted text.
Sourcepub const fn set_algorithm(self, algo: EncryptionAlgorithm) -> Self
pub const fn set_algorithm(self, algo: EncryptionAlgorithm) -> Self
Set the encryption algorithm to use.
Sourcepub fn aes(secret: impl Into<Bytes>) -> Self
Available on crate features aes
or aes-std
only.
pub fn aes(secret: impl Into<Bytes>) -> Self
aes
or aes-std
only.Create a new encryption with AES algorithm.
Sourcepub const fn algorithm(&self) -> EncryptionAlgorithm
pub const fn algorithm(&self) -> EncryptionAlgorithm
Get the encryption algorithm.
Sourcepub fn secret_bytes(&self) -> Bytes
pub fn secret_bytes(&self) -> Bytes
Returns the secret in bytes::Bytes
used to encrypt/decrypt the encrypted text.
Trait Implementations§
Source§impl Clone for Encryption
impl Clone for Encryption
Source§fn clone(&self) -> Encryption
fn clone(&self) -> Encryption
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 Debug for Encryption
impl Debug for Encryption
Source§impl Hash for Encryption
impl Hash for Encryption
Source§impl Message for Encryption
impl Message for Encryption
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
Decodes an instance of the message from a buffer, and merges it into
self
. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
Decodes a length-delimited instance of the message from buffer, and
merges it into
self
.Source§impl PartialEq for Encryption
impl PartialEq for Encryption
impl Eq for Encryption
impl StructuralPartialEq for Encryption
Auto Trait Implementations§
impl !Freeze for Encryption
impl RefUnwindSafe for Encryption
impl Send for Encryption
impl Sync for Encryption
impl Unpin for Encryption
impl UnwindSafe for Encryption
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