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
sourceimpl 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
sourceimpl<'de> Deserialize<'de> for Algorithm
impl<'de> Deserialize<'de> for Algorithm
sourcefn 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
sourceimpl From<AsymmetricEncryption> for Algorithm
impl From<AsymmetricEncryption> for Algorithm
sourcefn from(alg: AsymmetricEncryption) -> Algorithm
fn from(alg: AsymmetricEncryption) -> Algorithm
Converts to this type from the input type.
sourceimpl From<AsymmetricSignature> for Algorithm
impl From<AsymmetricSignature> for Algorithm
sourcefn from(alg: AsymmetricSignature) -> Algorithm
fn from(alg: AsymmetricSignature) -> Algorithm
Converts to this type from the input type.
sourceimpl From<KeyAgreement> for Algorithm
impl From<KeyAgreement> for Algorithm
sourcefn from(alg: KeyAgreement) -> Algorithm
fn from(alg: KeyAgreement) -> Algorithm
Converts to this type from the input type.
sourceimpl From<KeyDerivation> for Algorithm
impl From<KeyDerivation> for Algorithm
sourcefn from(alg: KeyDerivation) -> Algorithm
fn from(alg: KeyDerivation) -> Algorithm
Converts to this type from the input type.
sourceimpl PartialEq<Algorithm> for Algorithm
impl PartialEq<Algorithm> for Algorithm
sourceimpl Serialize for Algorithm
impl Serialize for Algorithm
sourcefn 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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