pub struct Cipher { /* private fields */ }
Expand description
Block cipher identifiers
Structure useful for handling an abstract representation of ciphers. Ciphers are defined foremost through their symmetric algorithm and, depending on the type of that algorithm, on a set of other values.
Implementations
sourceimpl Cipher
impl Cipher
sourcepub fn aes(mode: SymmetricMode, key_bits: u16) -> Result<Self>
pub fn aes(mode: SymmetricMode, key_bits: u16) -> Result<Self>
Constructor for AES cipher identifier
key_bits
must be one of 128, 192 or 256.
sourcepub fn camellia(mode: SymmetricMode, key_bits: u16) -> Result<Self>
pub fn camellia(mode: SymmetricMode, key_bits: u16) -> Result<Self>
Constructor for Camellia cipher identifier
key_bits
must be one of 128, 192 or 256.
sourcepub fn tdes(mode: SymmetricMode, key_bits: u16) -> Result<Self>
pub fn tdes(mode: SymmetricMode, key_bits: u16) -> Result<Self>
Constructor for Triple DES cipher identifier
key_bits
must be one of 56, 112 or 168.
sourcepub fn sm4(mode: SymmetricMode) -> Self
pub fn sm4(mode: SymmetricMode) -> Self
Constructor for SM4 cipher identifier
sourcepub fn xor(hash: HashingAlgorithm) -> Self
pub fn xor(hash: HashingAlgorithm) -> Self
Constructor for XOR “cipher” identifier
sourcepub fn object_type() -> AlgorithmIdentifier
pub fn object_type() -> AlgorithmIdentifier
Get general object type for symmetric ciphers.
sourcepub fn mode(self) -> Option<SymmetricMode>
pub fn mode(self) -> Option<SymmetricMode>
Get the cipher mode.
sourcepub fn hash(self) -> Option<HashingAlgorithm>
pub fn hash(self) -> Option<HashingAlgorithm>
Get the hash algorithm used with an XOR cipher
sourcepub fn algorithm(&self) -> SymmetricAlgorithm
pub fn algorithm(&self) -> SymmetricAlgorithm
Get the symmetrical algorithm for the cipher.
sourcepub fn aes_128_cfb() -> Self
pub fn aes_128_cfb() -> Self
Constructor for 128 bit AES in CFB mode.
sourcepub fn aes_256_cfb() -> Self
pub fn aes_256_cfb() -> Self
Constructor for 256 bit AES in CFB mode.
Trait Implementations
sourceimpl TryFrom<Cipher> for SymmetricDefinition
impl TryFrom<Cipher> for SymmetricDefinition
sourceimpl TryFrom<Cipher> for SymmetricDefinitionObject
impl TryFrom<Cipher> for SymmetricDefinitionObject
sourceimpl TryFrom<Cipher> for SymmetricCipherParameters
impl TryFrom<Cipher> for SymmetricCipherParameters
impl Copy 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more