From 742e1536d729a82d0bb345f04a06bce42e70cc65 Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Wed, 13 Mar 2019 10:12:00 +0100 Subject: [PATCH] Fix Private key verification --- lib/pki_evp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pki_evp.cpp b/lib/pki_evp.cpp index 7416a1e1..1ab6cc2a 100644 --- a/lib/pki_evp.cpp +++ b/lib/pki_evp.cpp @@ -799,7 +799,7 @@ bool pki_evp::verify_priv(EVP_PKEY *pkey) const /* Sign some random data in "md" */ if (EVP_PKEY_sign_init(ctx) <= 0) break; - if (getKeyType() == EVP_PKEY_RSA) + if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING); if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) break; @@ -815,7 +815,7 @@ bool pki_evp::verify_priv(EVP_PKEY *pkey) const if (ctx) EVP_PKEY_CTX_free(ctx); #endif - if (getKeyType() == EVP_PKEY_RSA && EVP_PKEY_isPrivKey(pkey)) { + if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA && EVP_PKEY_isPrivKey(pkey)) { RSA *rsa = EVP_PKEY_get0_RSA(pkey); if (RSA_check_key(rsa) != 1) verify = false;