From f1f95c4d99166bdb4a1d5d245acf91be4913adb7 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Fri, 15 Nov 2019 11:07:18 +0100 Subject: [PATCH] Display a more precise error message for unknown EC keys --- acme_common/src/crypto/openssl_keys.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/acme_common/src/crypto/openssl_keys.rs b/acme_common/src/crypto/openssl_keys.rs index 368c4ce..3e5a93f 100644 --- a/acme_common/src/crypto/openssl_keys.rs +++ b/acme_common/src/crypto/openssl_keys.rs @@ -23,8 +23,11 @@ macro_rules! get_key_type { Id::EC => match $key.ec_key()?.group().curve_name() { Some(Nid::X9_62_PRIME256V1) => KeyType::EcdsaP256, Some(Nid::SECP384R1) => KeyType::EcdsaP384, - _ => { - return Err("Unsupported EC key".into()); + Some(nid) => { + return Err(format!("{:?}: Unsupported EC key.", nid).into()); + } + None => { + return Err("None: Unsupported EC key".into()); } }, _ => {