summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/backend/nettle/asymmetric.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/crypto/backend/nettle/asymmetric.rs')
-rw-r--r--openpgp/src/crypto/backend/nettle/asymmetric.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/openpgp/src/crypto/backend/nettle/asymmetric.rs b/openpgp/src/crypto/backend/nettle/asymmetric.rs
index 06dcf2aa..2e631edd 100644
--- a/openpgp/src/crypto/backend/nettle/asymmetric.rs
+++ b/openpgp/src/crypto/backend/nettle/asymmetric.rs
@@ -16,6 +16,27 @@ use crate::crypto::SessionKey;
use crate::types::{Curve, HashAlgorithm};
impl Asymmetric for super::Backend {
+ fn supports_algo(algo: PublicKeyAlgorithm) -> bool {
+ use PublicKeyAlgorithm::*;
+ #[allow(deprecated)]
+ match algo {
+ RSAEncryptSign | RSAEncrypt | RSASign | DSA | ECDH | ECDSA | EdDSA
+ => true,
+ ElGamalEncrypt | ElGamalEncryptSign | Private(_) | Unknown(_)
+ => false,
+ }
+ }
+
+ fn supports_curve(curve: &Curve) -> bool {
+ use Curve::*;
+ match curve {
+ NistP256 | NistP384 | NistP521 | Ed25519 | Cv25519
+ => true,
+ BrainpoolP256 | BrainpoolP512 | Unknown(_)
+ => false,
+ }
+ }
+
fn x25519_generate_key() -> Result<(Protected, [u8; 32])> {
debug_assert_eq!(curve25519::CURVE25519_SIZE, 32);
let mut rng = Yarrow::default();