On Thu, Apr 28, 2016, Wouter Verhelst wrote: > Hi, > > I note that OpenSSL provides a function X509_ALGOR_set_md() to set > the message digest algorithm to be used on a signature, but it > doesn't seem to provide a corresponding X509_ALGOR_get_md() > function. > > Is this correct, or did I miss something? If I didn't miss anything, > then how can I figure out which hashing algorithm was used for a > given X.509 certificate? > You can retrieve the OID used in the X509_ALGOR structure using X509_ALGOR_get0(). If that OID corresponds to a digest directly you can call EVP_get_digestbyobj() on it. In many cases the OID you get will be a signature algorithm. In that case you convert it to a NID using OBJ_obj2nid() and call OBJ_find_sigid_algs() to get the digest NID and finally EVP_get_digestbynid(). Steve. -- Dr Stephen N. Henson. OpenSSL project core developer. Commercial tech support now available see: http://www.openssl.org