I can get the public key of SSL certificate using SecTrustCopyPublicKey. But how can get the Public key in string format?
Asked
Active
Viewed 334 times
1
-
Please go through the below link. https://stackoverflow.com/questions/15728636/how-to-pin-the-public-key-of-a-certificate-on-ios – Ganesh Bavaskar Aug 07 '17 at 10:51
1 Answers
0
if you want to save public key ec curve name, you can use this function:
string public_key_ec_curve_name(X509 *x509)
{
EVP_PKEY *pkey = X509_get_pubkey(x509);
int key_type = EVP_PKEY_type(pkey->type);
if (key_type == EVP_PKEY_EC)
{
cont EC_GROUP* group = EC_KEY_GET0_group(pkey->pkey.ec);
int name = (group != NULL) ? EC_GROUP_get_curve_name(group) : 0;
return name ? OBJ_nid2sn(name) : ";
}
return "";
}
it saves the public ec curve name in string format.

Saeed
- 159
- 3
- 13