[转载]借助openssl解析ECC公钥
void GetPubKey(const char* FilePath, char* PubKey) { unsigned char Cert[4099]; unsigned char *pTmp = NULL; FILE *fp = NULL; fp=fopen(FilePath,“rb”); if( NULL != fp) { X509 *usrCert = NULL; //X509证书结构体,保存用户证书 unsigned long Certlen = 0; Certlen=fread(Cert,1,4096,fp); fclose(fp); //判断是否为DER编码的用户证书,并转化为X509结构体 pTmp = Cert; //usrCert = d2i_X509(NULL,(const unsigned char ** )&pTmp,Certlen); //if( NULL == usrCert) { BIO b; / 判断是否为PEM格式的数字证书 */ b=BIO_new_file(FilePath,“r”); PEM_read_bio_X509(b, &usrCert, NULL, NULL); BIO_free(b); if(usrCert==NULL) { return; } } //保存证书公钥 int derpubkeyLen = 0; EVP_PKEY