[−][src]Struct secret_keeper::ciphers::xchacha20_comp::XChaCha20Compress
XChaCha20-Poly1305 cipher with LZ4 compression
Implementations
impl XChaCha20Compress
[src]
pub fn init_from(key: &[u8], nonce: &[u8]) -> Result<Self, Error>
[src]
Initialize cipher with provided key and nonce key length must be exactly KEYBYTES. nonce length must be >= NONCEBYTES
pub fn init() -> Result<Self, Error>
[src]
Initialize cipher, generating new key and nonce Key is generated with crate::rand (platform CSRNG)
pub fn with_nonce(nonce: &[u8]) -> Result<Self, Error>
[src]
Initialize cipher with nonce, generating new key Key is generated with crate::rand (platform CSRNG) Nonce length must be >= NONCEBYTES
Trait Implementations
impl Cipher for XChaCha20Compress
[src]
fn nonce_len(&self) -> usize
[src]
number of bytes in nonce for this cipher
fn key_len(&self) -> usize
[src]
number of bytes in key for this cipher
fn tag_len(&self) -> usize
[src]
fn get_nonce(&self) -> &[u8]
[src]
return nonce as slice
fn supports_aad(&self) -> bool
[src]
Returns whether or not this encryption supports aad
fn seal<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
plaintext: &'life1 [u8],
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
plaintext: &'life1 [u8],
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Encrypts the slice, with optional authenticated data Return value is a simple vector that contains the ciphertext plus a MAC-based authentication tag.
fn open<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ciphertext: &'life1 [u8],
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
ciphertext: &'life1 [u8],
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Decrypts and uncompresses the slice. The ciphertext buffer was created with seal(), and contains an appended auth tag. This method may be less efficient than open_detached, because it needs to make two heap allocs: one for decryption, and one for decompression. If you can use open_detached, the decryption is done in place so the first alloc is avoided. Return value is the decrypted plaintext.
fn seal_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
file_path: &'life1 str,
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<(Bytes, AuthTag, u64), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
file_path: &'life1 str,
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<(Bytes, AuthTag, u64), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Compress and encrypt the file, with optional associated data.
fn seal_write<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
data: &'life1 mut [u8],
file: &'life2 mut File,
_aad: Option<&'life3 [u8]>
) -> Pin<Box<dyn Future<Output = Result<(AuthTag, u64), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
data: &'life1 mut [u8],
file: &'life2 mut File,
_aad: Option<&'life3 [u8]>
) -> Pin<Box<dyn Future<Output = Result<(AuthTag, u64), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Encrypt the data and append to the file. Returns the auth tag and length of data appended
fn open_read<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
file: &'life1 mut File,
len: u64,
size_hint: Option<u64>,
tag: &'life2 [u8],
_aad: Option<&'life3 [u8]>
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
file: &'life1 mut File,
len: u64,
size_hint: Option<u64>,
tag: &'life2 [u8],
_aad: Option<&'life3 [u8]>
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Read len bytes from the file and decrypt Returns data as Bytes. In compressing cipher, size_hint should be used if size of decompressed data is known.
fn seal_detached<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
src: &'life1 mut [u8],
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<AuthTag, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
src: &'life1 mut [u8],
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<AuthTag, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Encrypt the slice, with optional associated data.
fn open_detached<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_buf: &'life1 mut [u8],
_tag: &'life2 [u8],
_aad: Option<&'life3 [u8]>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_buf: &'life1 mut [u8],
_tag: &'life2 [u8],
_aad: Option<&'life3 [u8]>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Decrypts the data in-place Note: this is not applicable for compressed encryptors because the decrypted data may exceed the provided buffer length. Use open_compressed instead.
fn export<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
uri: &'life1 str,
nonce: &'life2 [u8],
keeper: &'life3 Box<dyn SecretKeeper>
) -> Pin<Box<dyn Future<Output = Result<WrappedKey, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
uri: &'life1 str,
nonce: &'life2 [u8],
keeper: &'life3 Box<dyn SecretKeeper>
) -> Pin<Box<dyn Future<Output = Result<WrappedKey, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Export key by encrypting and wrapping it
impl CompressingCipher for XChaCha20Compress
[src]
fn seal_compressed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
src: &'life1 [u8],
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<(Bytes, AuthTag), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
src: &'life1 [u8],
_aad: Option<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<(Bytes, AuthTag), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Compress and encrypt the slice, with optional associated data.
fn open_compressed<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
src: &'life1 mut [u8],
tag: &'life2 [u8],
size_hint: Option<u64>,
_aad: Option<&'life3 [u8]>
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
src: &'life1 mut [u8],
tag: &'life2 [u8],
size_hint: Option<u64>,
_aad: Option<&'life3 [u8]>
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Decrypt slice into the provided buffer. src: compressed ciphertext tag: auth tag size_hint: optional size used to allocate buffer for result
impl Debug for XChaCha20Compress
[src]
Implementation of Debug that doesn't print key to prevent accidental leaks via logging
impl Import for XChaCha20Compress
[src]
fn import<'life0, 'life1, 'life2, 'async_trait>(
nonce: &'life0 [u8],
keeper: &'life1 Box<dyn SecretKeeper>,
wrapped: &'life2 WrappedKey
) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
nonce: &'life0 [u8],
keeper: &'life1 Box<dyn SecretKeeper>,
wrapped: &'life2 WrappedKey
) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Import key by unwrapping and decrypting it
Auto Trait Implementations
impl RefUnwindSafe for XChaCha20Compress
impl Send for XChaCha20Compress
impl Sync for XChaCha20Compress
impl Unpin for XChaCha20Compress
impl UnwindSafe for XChaCha20Compress
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,