pub fn is_alg_permitted(self, alg: AsymmetricSignature) -> bool {
        match self {
            AsymmetricSignature::RsaPkcs1v15Sign {
                hash_alg: hash_policy,
            } => {
                if let AsymmetricSignature::RsaPkcs1v15Sign { hash_alg } = alg {
                    hash_policy.is_alg_permitted(hash_alg)
                } else {
                    false
                }
            }
            AsymmetricSignature::RsaPss {
                hash_alg: hash_policy,
            } => {
                if let AsymmetricSignature::RsaPss { hash_alg } = alg {
                    hash_policy.is_alg_permitted(hash_alg)
                } else {
                    false
                }
            }
            AsymmetricSignature::Ecdsa {
                hash_alg: hash_policy,
            } => {
                if let AsymmetricSignature::Ecdsa { hash_alg } = alg {
                    hash_policy.is_alg_permitted(hash_alg)
                } else {
                    false
                }
            }
            AsymmetricSignature::DeterministicEcdsa {
                hash_alg: hash_policy,
            } => {
                if let AsymmetricSignature::DeterministicEcdsa { hash_alg } = alg {
                    hash_policy.is_alg_permitted(hash_alg)
                } else {
                    false
                }
            }
            // These ones can not be wildcard algorithms
            asymmetric_signature_alg => asymmetric_signature_alg == alg,
        }
    }
/// Check if the alg given for a cryptographic operation is permitted to be used with this
/// algorithm as a policy
///
/// # Example
///
/// ```
/// use psa_crypto::types::algorithm::{AsymmetricSignature, SignHash, Hash};
/// assert!(AsymmetricSignature::RsaPkcs1v15Sign { hash_alg: SignHash::Any }
///         .is_alg_permitted(AsymmetricSignature::RsaPkcs1v15Sign {
///             hash_alg:  SignHash::Specific(Hash::Sha1)
///         })
///        );
/// assert!(!AsymmetricSignature::RsaPkcs1v15Sign { hash_alg: SignHash::Specific(Hash::Sha256) }
///         .is_alg_permitted(AsymmetricSignature::RsaPkcs1v15Sign {
///             hash_alg:  SignHash::Specific(Hash::Sha1)
///         })
///        );
/// ```
Check if the alg given for a cryptographic operation is permitted to be used with this
algorithm as a policy
Check if the alg given for a cryptographic operation is permitted to be used with this algorithm as a policy
pub fn is_alg_permitted(self, alg: AsymmetricSignature) -> bool {
        match self {
            AsymmetricSignature::RsaPkcs1v15Sign {
                hash_alg: hash_policy,
            } => {
                if let AsymmetricSignature::RsaPkcs1v15Sign { hash_alg } = alg {
                    hash_policy.is_alg_permitted(hash_alg)
                } else {
                    false
                }
            }
            AsymmetricSignature::RsaPss {
                hash_alg: hash_policy,
            } => {
                if let AsymmetricSignature::RsaPss { hash_alg } = alg {
                    hash_policy.is_alg_permitted(hash_alg)
                } else {
                    false
                }
            }
            AsymmetricSignature::Ecdsa {
                hash_alg: hash_policy,
            } => {
                if let AsymmetricSignature::Ecdsa { hash_alg } = alg {
                    hash_policy.is_alg_permitted(hash_alg)
                } else {
                    false
                }
            }
            AsymmetricSignature::DeterministicEcdsa {
                hash_alg: hash_policy,
            } => {
                if let AsymmetricSignature::DeterministicEcdsa { hash_alg } = alg {
                    hash_policy.is_alg_permitted(hash_alg)
                } else {
                    false
                }
            }
            // These ones can not be wildcard algorithms
            asymmetric_signature_alg => asymmetric_signature_alg == alg,
        }
    }
pub fn is_alg_permitted ( self , alg : AsymmetricSignature ) -> bool { match self { AsymmetricSignature :: RsaPkcs1v15Sign { hash_alg : hash_policy , } => { if let AsymmetricSignature :: RsaPkcs1v15Sign { hash_alg } = alg { hash_policy . is_alg_permitted ( hash_alg ) } else { false } } AsymmetricSignature :: RsaPss { hash_alg : hash_policy , } => { if let AsymmetricSignature :: RsaPss { hash_alg } = alg { hash_policy . is_alg_permitted ( hash_alg ) } else { false } } AsymmetricSignature :: Ecdsa { hash_alg : hash_policy , } => { if let AsymmetricSignature :: Ecdsa { hash_alg } = alg { hash_policy . is_alg_permitted ( hash_alg ) } else { false } } AsymmetricSignature :: DeterministicEcdsa { hash_alg : hash_policy , } => { if let AsymmetricSignature :: DeterministicEcdsa { hash_alg } = alg { hash_policy . is_alg_permitted ( hash_alg ) } else { false } } // These ones can not be wildcard algorithms asymmetric_signature_alg => asymmetric_signature_alg == alg , } }
Check if the alg given for a cryptographic operation is permitted to be used with this
algorithm as a policy
Check if the alg given for a cryptographic operation is permitted to be used with this algorithm as a policy
self
alg
AsymmetricSignature
self
alg
AsymmetricSignature
example
```
use psa_crypto::types::algorithm::{AsymmetricSignature, SignHash, Hash};
assert!(AsymmetricSignature::RsaPkcs1v15Sign { hash_alg: SignHash::Any }
.is_alg_permitted(AsymmetricSignature::RsaPkcs1v15Sign {
hash_alg:  SignHash::Specific(Hash::Sha1)
})
);
assert!(!AsymmetricSignature::RsaPkcs1v15Sign { hash_alg: SignHash::Specific(Hash::Sha256) }
.is_alg_permitted(AsymmetricSignature::RsaPkcs1v15Sign {
hash_alg:  SignHash::Specific(Hash::Sha1)
})
);
```
` ` ` use psa_crypto :: types :: algorithm :: { AsymmetricSignature SignHash Hash } ; assert! ( AsymmetricSignature :: RsaPkcs1v15Sign { hash_alg : SignHash :: Any } . is_alg_permitted ( AsymmetricSignature :: RsaPkcs1v15Sign { hash_alg : SignHash :: Specific ( Hash :: Sha1 ) } ) ) ; assert! ( !AsymmetricSignature :: RsaPkcs1v15Sign { hash_alg : SignHash :: Specific ( Hash :: Sha256 ) } . is_alg_permitted ( AsymmetricSignature :: RsaPkcs1v15Sign { hash_alg : SignHash :: Specific ( Hash :: Sha1 ) } ) ) ; ` ` `