X509* CCertTools::GetX509FromDer(char *filePath) { int content_length = 0; char* pContent = FileUtils::ReadFileContent(filePath, content_length); char* pTemp = pContent; X509* pCert = d2i_X509(NULL, (const unsigned char**)&pTemp, content_length); if (pContent!=NULL){ free(pContent); pContent = NULL; } return pCert; }