pub struct SymBlockCipherKey { /* private fields */ }Expand description
A symmetric block cipher key.
Associate the raw key material with a symmetric block cipher algorithm identifier.
May get instantiate either through key generation or from
an existing raw key via TryFrom.
Implementations§
Source§impl SymBlockCipherKey
impl SymBlockCipherKey
Sourcepub fn get_block_cipher_alg(&self) -> SymBlockCipherAlg
pub fn get_block_cipher_alg(&self) -> SymBlockCipherAlg
Get the key’s associated symmetric block cipher algorithm identifier.
Sourcepub fn generate(
block_cipher_alg: SymBlockCipherAlg,
rng: &mut dyn RngCoreDispatchable,
additional_rng_generate_input: Option<&[Option<&[u8]>]>,
) -> Result<Self, CryptoError>
pub fn generate( block_cipher_alg: SymBlockCipherAlg, rng: &mut dyn RngCoreDispatchable, additional_rng_generate_input: Option<&[Option<&[u8]>]>, ) -> Result<Self, CryptoError>
Generate a new block cipher key.
§Arguments:
block_cipher_alg- The block cipher algorithm to generate a key for.rng- The random number generator to obtain key material from.additional_rng_generate_input- Additional input to pass along to therng’s generate() primitive.
Sourcepub fn instantiate_block_cipher_mode_enc(
&self,
mode: TpmiAlgCipherMode,
) -> Result<SymBlockCipherModeEncryptionInstance, CryptoError>
pub fn instantiate_block_cipher_mode_enc( &self, mode: TpmiAlgCipherMode, ) -> Result<SymBlockCipherModeEncryptionInstance, CryptoError>
Instantiate a block cipher mode encryption instance for the key.
§Arguments:
mode- The block cipher mode to instantiate an encryption instance with the key for.
Sourcepub fn instantiate_block_cipher_mode_dec(
&self,
mode: TpmiAlgCipherMode,
) -> Result<SymBlockCipherModeDecryptionInstance, CryptoError>
pub fn instantiate_block_cipher_mode_dec( &self, mode: TpmiAlgCipherMode, ) -> Result<SymBlockCipherModeDecryptionInstance, CryptoError>
Instantiate a block cipher mode decryption instance for the key.
§Arguments:
mode- The block cipher mode to instantiate an decryption instance with the key for.
Trait Implementations§
Source§impl TryFrom<(SymBlockCipherAlg, &[u8])> for SymBlockCipherKey
impl TryFrom<(SymBlockCipherAlg, &[u8])> for SymBlockCipherKey
Source§fn try_from(value: (SymBlockCipherAlg, &[u8])) -> Result<Self, Self::Error>
fn try_from(value: (SymBlockCipherAlg, &[u8])) -> Result<Self, Self::Error>
Construct a SymBlockCipherKey from a pair of symmetric block cipher
algorithm identifier and a raw key byte slice.
Source§type Error = CryptoError
type Error = CryptoError
The type returned in the event of a conversion error.
Source§impl TryFrom<(SymBlockCipherAlg, Zeroizing<Vec<u8>>)> for SymBlockCipherKey
impl TryFrom<(SymBlockCipherAlg, Zeroizing<Vec<u8>>)> for SymBlockCipherKey
Source§fn try_from(
value: (SymBlockCipherAlg, Zeroizing<Vec<u8>>),
) -> Result<Self, Self::Error>
fn try_from( value: (SymBlockCipherAlg, Zeroizing<Vec<u8>>), ) -> Result<Self, Self::Error>
Destructure a SymBlockCipherKey into a pair of symmetric block
cipher algorithm identifier and a raw key byte
Vec.
Source§type Error = CryptoError
type Error = CryptoError
The type returned in the event of a conversion error.
impl ZeroizeOnDrop for SymBlockCipherKey
Auto Trait Implementations§
impl Freeze for SymBlockCipherKey
impl RefUnwindSafe for SymBlockCipherKey
impl Send for SymBlockCipherKey
impl Sync for SymBlockCipherKey
impl Unpin for SymBlockCipherKey
impl UnsafeUnpin for SymBlockCipherKey
impl UnwindSafe for SymBlockCipherKey
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