Created
February 14, 2019 05:49
-
-
Save devendranaga/2259d8d239b526ed661864f97ed835ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loads in the pubkey | |
int load_pubkey(std::string pubkey) | |
{ | |
FILE *fp; | |
// load in the keys | |
fp = fopen(pubkey.c_str(), "r"); | |
if (!fp) { | |
return -1; | |
} | |
publickey = PEM_read_EC_PUBKEY(fp, NULL, NULL, NULL); | |
if (!publickey) { | |
ERR_print_errors_fp(stderr); | |
return -1; | |
} | |
evp_verify_key = EVP_PKEY_new(); | |
int ret; | |
ret = EVP_PKEY_assign_EC_KEY(evp_verify_key, publickey); | |
if (ret != 1) { | |
ERR_print_errors_fp(stderr); | |
return -1; | |
} | |
fclose(fp); | |
std::cout << "pubkey load ok" << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment