I have a public key in the form of
-----BEGIN PUBLIC KEY-----
MIIB...
-----END PUBLIC KEY-----
that was created using OpenSSL. I attempt to load it into memory like such:
FILE* file = fopen("public.pem","r");
if (file != nullptr)
{
//This can be changed to this for the same results:
//RSA* rsa = PEM_read_RSAPublicKey(file, nullptr, nullptr, nullptr);
RSA* rsa = PEM_read_RSA_PUBKEY(file, nullptr, nullptr, nullptr);
//etc...
}
Whenever it gets to the RSA* rsa =... line the program crashes. I have seen the other post for this and (as you can see) I have tried it the solution and it doesn't work.
I have tried using the BIO versions and the program does not crash but I do get the error "no start line".
Any ideas as to what can be causing this?