<div dir="ltr">Hi guys!<div><br></div><div>I'm trying to upgrade an old C project from OpenSSL 1.0.2 to the newest 1.1.1 version. Everything's going smoothly, except for one little detail:</div><div><br></div><div>There's a part of the code where we're doing a sha256 hash of the public key of our certificate. On the older OpenSSL, we were able to get the public key by doing cert->cert_info->key->public_key->data. On the newer version, we no longer have access to the cert_info struct.</div><div><br></div><div>I tried doing:</div><div><br></div><div>EVP_PKEY * public_key = X509_get0_pubkey(cert);</div><div><br></div><div>this gives me an EVP_PKEY value, which I tried to convert to a char** by doing this:</div><div><br></div><div>unsigned char *buf, *p;</div><div>int len = i2d_PublicKey(public_key, NULL);</div><div>buf = OPENSSL_malloc(len);</div><div>p = buf;</div><div>i2d_PublicKey(public_key, &p);</div><div><br></div><div>This gives me a buffer with the correct length, but it seems like it has different data from what the public_key->data used to give me.</div><div><br></div><div>Granted, I am not very savvy with OpenSSL, or with ssl in general, so maybe I'm doing something wrong/dumb? I've spent a fair bit of time on the documentation/wiki but I canĀ“t seem to find the answer. Seems to me like this should be something very straightforward?</div><div><br></div><div>Any help would be v much appreciated</div><div><br></div><div>-Daniel</div><div><br></div></div>