"); //-->
int read_extcert_base_hashvalue(unsigned char *pFileName, int nFileNameLen, unsigned char *pFileContent, int *nFileContentLen) { FILE *fp = NULL; size_t lFileLen = 0; char szFileName[65] = {0}; char pFilePathName[260] = {0}; ByteToHexStr(pFileName, szFileName, nFileNameLen); sprintf(pFilePathName, "%s/%s.cert",EXT_FILEPATH, szFileName); //打开文件 fp = fopen(pFilePathName, "r"); if (fp == NULL) { DebugOutPutErr("%s -->> fopen failed:%d(%d)\n", __FUNCTION__, errno, __LINE__); return FILE_ERR_OPEN_FAILED; } // 读取文件长度 fseek(fp, 0L, SEEK_END); lFileLen = ftell(fp); fseek(fp, 0L, SEEK_SET); if(*nFileContentLen < (int)lFileLen) { DebugOutPutErr("%s --> buffer is too small: %d < %d\n", __FUNCTION__, *nFileContentLen, lFileLen); return BUFFER_ERR_OVERFLOW; } //读取文件 *nFileContentLen = (int)fread(pFileContent, 1, lFileLen,fp); fclose(fp); return 0; }
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。