pub enum Algorithm {
None,
Hash(Hash),
Mac(Mac),
Cipher(Cipher),
Aead(Aead),
AsymmetricSignature(AsymmetricSignature),
AsymmetricEncryption(AsymmetricEncryption),
KeyAgreement(KeyAgreement),
KeyDerivation(KeyDerivation),
}
Expand description
Enumeration of possible algorithm definitions. Each variant of the enum contains a main algorithm type (which is required for that variant).
Variants§
None
An invalid algorithm identifier value.
None
does not allow any cryptographic operation with the key. The key can still be
used for non-cryptographic actions such as exporting, if permitted by the usage flags.
Hash(Hash)
Hash algorithm.
Mac(Mac)
MAC algorithm.
Cipher(Cipher)
Symmetric Cipher algorithm.
Aead(Aead)
Authenticated Encryption with Associated Data (AEAD) algorithm.
AsymmetricSignature(AsymmetricSignature)
Public-key signature algorithm.
AsymmetricEncryption(AsymmetricEncryption)
Public-key encryption algorithm.
KeyAgreement(KeyAgreement)
Key agreement algorithm.
KeyDerivation(KeyDerivation)
Key derivation algorithm.
Implementations§
source§impl Algorithm
impl Algorithm
sourcepub fn is_hmac(self) -> bool
pub fn is_hmac(self) -> bool
Check if the algorithm is a HMAC algorithm, truncated or not
Example
use psa_crypto::types::algorithm::{Algorithm, Mac, FullLengthMac, Hash};
let hmac = Algorithm::Mac(Mac::Truncated {
mac_alg: FullLengthMac::Hmac { hash_alg: Hash::Sha256 },
mac_length: 30,
});
assert!(hmac.is_hmac());
Trait Implementations§
source§impl<'de> Deserialize<'de> for Algorithm
impl<'de> Deserialize<'de> for Algorithm
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Algorithm, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Algorithm, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<AsymmetricEncryption> for Algorithm
impl From<AsymmetricEncryption> for Algorithm
source§fn from(alg: AsymmetricEncryption) -> Algorithm
fn from(alg: AsymmetricEncryption) -> Algorithm
Converts to this type from the input type.
source§impl From<AsymmetricSignature> for Algorithm
impl From<AsymmetricSignature> for Algorithm
source§fn from(alg: AsymmetricSignature) -> Algorithm
fn from(alg: AsymmetricSignature) -> Algorithm
Converts to this type from the input type.
source§impl From<KeyAgreement> for Algorithm
impl From<KeyAgreement> for Algorithm
source§fn from(alg: KeyAgreement) -> Algorithm
fn from(alg: KeyAgreement) -> Algorithm
Converts to this type from the input type.
source§impl From<KeyDerivation> for Algorithm
impl From<KeyDerivation> for Algorithm
source§fn from(alg: KeyDerivation) -> Algorithm
fn from(alg: KeyDerivation) -> Algorithm
Converts to this type from the input type.
source§impl PartialEq for Algorithm
impl PartialEq for Algorithm
source§impl Serialize for Algorithm
impl Serialize for Algorithm
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Algorithm
impl Eq for Algorithm
impl StructuralEq for Algorithm
impl StructuralPartialEq for Algorithm
Auto Trait Implementations§
impl RefUnwindSafe for Algorithm
impl Send for Algorithm
impl Sync for Algorithm
impl Unpin for Algorithm
impl UnwindSafe for Algorithm
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