I have a privatekey.pem file which is protected by a password, how can I open it with the password in c++ and convert it to std::string? I have written this function:
auto read_file(std::string private_key_path)-> std::string
{
std::string keypass= "pass";
char * keypass_byte= const_cast<char*>( keypass.c_str() );
//open the private key file
FILE *fp = fopen(private_key_path.c_str(), "r");
EVP_PKEY *pkey = PEM_read_PrivateKey(fp, NULL, NULL,
keypass_byte);
How To convert it to string????
return private_key;
}