I have a P12 file which I am trying to parse programmatically. I am successful in parsing it.
When I use the code as standalone and use -ssl and -crypto on command line it works fine. But when I use the same code in my application I get Undefined reference error : In function sk_X509_num undefined reference to OpenSSL_sk_num and In function sk_X509_value undefined reference to OPENSSL_sk_value
Below is the code snippet I am using :
{
Bio *b = Bio_new(BIO_s_mem());
if(b != nullptr)
{
for(int i=0; i< sk_X509_num(ca);i++)
{
if(!PEM_write_bio_X509(b, sk_X509_value(ca,i)))
{
//some log message.....
}
else
{
//some code here
}
}
I have included in makefile the following flags : LDFLAGS+= -lssl -lcrypto The OPENSSL Version is 1.1.1g