pub enum Cipher {
XChaCha20Poly1305,
AesGcm256,
X25519,
}Expand description
Supported cipher algorithms.
Variants§
XChaCha20Poly1305
Cipher for XChaCha20Poly1305 encryption.
AesGcm256
Cipher for AES-GCM 256 bit encryption.
X25519
X25519 asymmetric encryption using AGE.
Implementations§
Source§impl Cipher
impl Cipher
Sourcepub async fn encrypt_symmetric(
&self,
key: &PrivateKey,
plaintext: &[u8],
nonce: Option<Nonce>,
) -> Result<AeadPack, Error>
pub async fn encrypt_symmetric( &self, key: &PrivateKey, plaintext: &[u8], nonce: Option<Nonce>, ) -> Result<AeadPack, Error>
Encrypt plaintext using this cipher.
Sourcepub async fn decrypt_symmetric(
&self,
key: &PrivateKey,
aead: &AeadPack,
) -> Result<Vec<u8>, Error>
pub async fn decrypt_symmetric( &self, key: &PrivateKey, aead: &AeadPack, ) -> Result<Vec<u8>, Error>
Decrypt ciphertext using this cipher.
Sourcepub async fn encrypt_asymmetric(
&self,
key: &PrivateKey,
plaintext: &[u8],
recipients: Vec<Recipient>,
) -> Result<AeadPack, Error>
pub async fn encrypt_asymmetric( &self, key: &PrivateKey, plaintext: &[u8], recipients: Vec<Recipient>, ) -> Result<AeadPack, Error>
Encrypt plaintext using this cipher.
Sourcepub async fn decrypt_asymmetric(
&self,
key: &PrivateKey,
aead: &AeadPack,
) -> Result<Vec<u8>, Error>
pub async fn decrypt_asymmetric( &self, key: &PrivateKey, aead: &AeadPack, ) -> Result<Vec<u8>, Error>
Decrypt ciphertext using this cipher.
Trait Implementations§
Source§impl Decodable for Cipher
impl Decodable for Cipher
Source§impl<'de> Deserialize<'de> for Cipher
impl<'de> Deserialize<'de> for Cipher
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Encodable for Cipher
impl Encodable for Cipher
Source§fn encode<'life0, 'life1, 'async_trait, W>(
&'life0 self,
writer: &'life1 mut BinaryWriter<W>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
W: 'async_trait + AsyncWrite + AsyncSeek + Unpin + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn encode<'life0, 'life1, 'async_trait, W>(
&'life0 self,
writer: &'life1 mut BinaryWriter<W>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
W: 'async_trait + AsyncWrite + AsyncSeek + Unpin + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Encode self into the binary writer.
impl Copy for Cipher
impl Eq for Cipher
impl StructuralPartialEq for Cipher
Auto Trait Implementations§
impl Freeze for Cipher
impl RefUnwindSafe for Cipher
impl Send for Cipher
impl Sync for Cipher
impl Unpin for Cipher
impl UnwindSafe for Cipher
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