Set X509 public key in 1.0.2
Ken Goldman
kgoldman at us.ibm.com
Fri Aug 20 22:31:27 UTC 2021
I have an X509_PUBKEY structure holding the algorithm and public key.
I want to set it in the X509 structure.
In 1.1.1 and up, I can use
evpPubkey = X509_PUBKEY_get0(addToCert->key); /* X509_PUBKEY */
X509_set_pubkey(x509Certificate, evpPubkey);
However, 1.0.2 doesn't have these.
What's a good approach?
I could access the X509.cert_info.key and set the
value, but I expect that would cause a double free later
when I free both the X509 and the structure holding the
X509_PUBKEY.
Is the something like a X509_PUBKEY_dup function?
(Yes, I know that 1.0.2 is obsolete, but there are some LTS
distros, and I'd rather not drop support for 1.0.2 if I can
figure this out.)
More information about the openssl-users
mailing list