 <p>I hope the below code will give u an idea .. If your PEM doesnt have password ...... refer X509.h header file in openssl</p> <pre><code>X509* oCertificate=NULL; FILE *lFp=NULL; lFp=fopen(iFilePath,"rb"); if(lFp==NULL) { oCertificate=NULL; cout &lt;&lt;("Error File cannot be opened(file missing) ")&lt;&lt;iFilePath ; } else { oCertificate = PEM_read_X509(lFp, NULL, NULL, NULL); fclose(lFp); } return oCertificate; </code></pre>