[−][src]Struct secret_keeper::ciphers::aesgcm256::AesGcm256
Cipher implementation of AES-GCM (Galois/Counter Mode) with 256-bit keys with optional architecture-specific hardware acceleration encryption implemented by RustCrypto
See link above for compiler settings (RUSTFLAGS) to enable processor-specific optimizations.
Implementations
impl AesGcm256
[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 AesGcm256
[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 the in-memory block, with optional authenticated data
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,
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,
Encrypts the file, with optional associated data, Returns encrypted data, tag, and file size
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 non-compressing cipher, data.len() == len, so size_hint is ignored.
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 buf: mutable buffer containing ciphertext (in), to be overwritten with plaintext tag: auth tag data aad: optional additional authenticated data
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 Debug for AesGcm256
[src]
Implementation of Debug that doesn't print key to prevent accidental leaks via logging
impl Import for AesGcm256
[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 AesGcm256
impl Send for AesGcm256
impl Sync for AesGcm256
impl Unpin for AesGcm256
impl UnwindSafe for AesGcm256
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>,