Enum nuts_container::container::Cipher
source · pub enum Cipher {
None,
Aes128Ctr,
Aes128Gcm,
}Expand description
Supported cipher algorithms.
Variants§
None
No encryption.
Aes128Ctr
AES with a 128-bit key in CTR mode
Aes128Gcm
AES with a 128-bit key in GCM mode
Implementations§
source§impl Cipher
impl Cipher
sourcepub fn block_size(&self) -> usize
pub fn block_size(&self) -> usize
Returns the block size of the cipher.
sourcepub fn tag_size(&self) -> u32
pub fn tag_size(&self) -> u32
Returns the tag size of the cipher.
An AE-cipher results into a
- ciphertext
- tag
Ciphertext and tag are both stored in a block of the container. Use
this method to get the size of the tag. For a non-AE-cipher the
tag-size is 0.
pub fn decrypt<B: Backend>( &self, input: &[u8], output: &mut Vec<u8>, key: &[u8], iv: &[u8] ) -> ContainerResult<usize, B>
pub fn encrypt<B: Backend>( &self, input: &[u8], output: &mut Vec<u8>, key: &[u8], iv: &[u8] ) -> ContainerResult<usize, B>
Trait Implementations§
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 PartialEq for Cipher
impl PartialEq for Cipher
impl Copy for Cipher
impl StructuralPartialEq for Cipher
Auto Trait Implementations§
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