pub struct ChaCha20Poly1305Encryptor { /* private fields */ }Available on crate features
signatures and encryption-chacha only.Expand description
ChaCha20-Poly1305 encryptor.
Implementations§
Source§impl ChaCha20Poly1305Encryptor
impl ChaCha20Poly1305Encryptor
Sourcepub fn generate_key() -> [u8; 32]
pub fn generate_key() -> [u8; 32]
Generate a new random encryption key.
Sourcepub fn generate_nonce() -> [u8; 12]
pub fn generate_nonce() -> [u8; 12]
Generate a random nonce.
Sourcepub fn encrypt(&self, plaintext: &[u8]) -> Result<EncryptedData>
pub fn encrypt(&self, plaintext: &[u8]) -> Result<EncryptedData>
Sourcepub fn encrypt_with_nonce(
&self,
plaintext: &[u8],
nonce: &[u8; 12],
) -> Result<EncryptedData>
pub fn encrypt_with_nonce( &self, plaintext: &[u8], nonce: &[u8; 12], ) -> Result<EncryptedData>
Auto Trait Implementations§
impl Freeze for ChaCha20Poly1305Encryptor
impl RefUnwindSafe for ChaCha20Poly1305Encryptor
impl Send for ChaCha20Poly1305Encryptor
impl Sync for ChaCha20Poly1305Encryptor
impl Unpin for ChaCha20Poly1305Encryptor
impl UnsafeUnpin for ChaCha20Poly1305Encryptor
impl UnwindSafe for ChaCha20Poly1305Encryptor
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