diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2021-09-09 15:14:20 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2021-09-16 12:51:19 +0200 |
commit | e939ea0fbc206856709955fe1937ff635749d4e7 (patch) | |
tree | b4dab6c9d3fe2b9ed4bf4758f0a7fb9cca7ede71 /openpgp/src/types | |
parent | 794d128c704934e828302a7f02df66c72fe7819e (diff) |
openpgp: Make list of supported algorithms backend-dependent.
Diffstat (limited to 'openpgp/src/types')
-rw-r--r-- | openpgp/src/types/mod.rs | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/openpgp/src/types/mod.rs b/openpgp/src/types/mod.rs index 750ef2ca..09b79f9d 100644 --- a/openpgp/src/types/mod.rs +++ b/openpgp/src/types/mod.rs @@ -195,14 +195,7 @@ impl PublicKeyAlgorithm { /// assert!(!PublicKeyAlgorithm::Private(101).is_supported()); /// ``` pub fn is_supported(&self) -> bool { - use self::PublicKeyAlgorithm::*; - #[allow(deprecated)] - match &self { - RSAEncryptSign | RSAEncrypt | RSASign | DSA | ECDH | ECDSA | EdDSA - => true, - ElGamalEncrypt | ElGamalEncryptSign | Private(_) | Unknown(_) - => false, - } + self.is_supported_by_backend() } } @@ -491,13 +484,7 @@ impl Curve { /// assert!(!Curve::Unknown(Box::new([0x2B, 0x11])).is_supported()); /// ``` pub fn is_supported(&self) -> bool { - use self::Curve::*; - match &self { - NistP256 | NistP384 | NistP521 | Ed25519 | Cv25519 - => true, - BrainpoolP256 | BrainpoolP512 | Unknown(_) - => false, - } + self.is_supported_by_backend() } } @@ -738,13 +725,7 @@ impl AEADAlgorithm { /// assert!(!AEADAlgorithm::OCB.is_supported()); /// ``` pub fn is_supported(&self) -> bool { - use self::AEADAlgorithm::*; - match &self { - EAX - => true, - OCB | Private(_) | Unknown(_) - => false, - } + self.is_supported_by_backend() } } |