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
sourcepub fn deserialize<__D>(
__deserializer: __D
) -> Result<Algorithm, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub 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
sourcepub fn from(alg: AsymmetricEncryption) -> Algorithm
pub fn from(alg: AsymmetricEncryption) -> Algorithm
Performs the conversion.
sourceimpl From<AsymmetricSignature> for Algorithm
impl From<AsymmetricSignature> for Algorithm
sourcepub fn from(alg: AsymmetricSignature) -> Algorithm
pub fn from(alg: AsymmetricSignature) -> Algorithm
Performs the conversion.
sourceimpl From<KeyAgreement> for Algorithm
impl From<KeyAgreement> for Algorithm
sourcepub fn from(alg: KeyAgreement) -> Algorithm
pub fn from(alg: KeyAgreement) -> Algorithm
Performs the conversion.
sourceimpl From<KeyDerivation> for Algorithm
impl From<KeyDerivation> for Algorithm
sourcepub fn from(alg: KeyDerivation) -> Algorithm
pub fn from(alg: KeyDerivation) -> Algorithm
Performs the conversion.
sourceimpl Serialize for Algorithm
impl Serialize for Algorithm
sourcepub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub 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 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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more