[openssl-users] EVP_get_digestbyobj fails for ecdsa-with-SHA256

Dr. Stephen Henson steve at openssl.org
Fri Jul 8 12:08:08 UTC 2016

On Thu, Jul 07, 2016, Chris Bare wrote:

> Ok, that makes sense with what I'm seeing. I just tried changing this:
>     const EVP_MD* md = EVP_get_digestbyobj(sig_alg_oid);
> to this:
>     const EVP_MD* md = EVP_get_digestbyname("SHA256");
> and it all worked correctly.
> so given that I have an OID for ecdsa-with-SHA256, is there a function that
> will return just the digest algorithm?
> I'm trying to be as flexible as possible, so I don't want to hard code this
> or have my own limited lookup table.

OBJ_find_sigid_algs() you pass it the NID of the signature algorithm and it
reurns the public key NID and the digest NID.

Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org

More information about the openssl-users mailing list