| 1321 | } |
| 1322 | |
| 1323 | int ECPubKeyToString(EC_KEY* pPriKey, std::string* pKeyString) |
| 1324 | { |
| 1325 | if(!pKeyString) |
| 1326 | { |
| 1327 | MMERR("ERR %s invalid",__func__); |
| 1328 | return CRYPT_ERR_INVALID_PARAM; |
| 1329 | } |
| 1330 | int ret = 0; |
| 1331 | int r_len = 0; |
| 1332 | unsigned char* out =NULL; |
| 1333 | r_len = i2o_ECPublicKey(pPriKey,&out); |
| 1334 | if( r_len == 0 || ( !out)) |
| 1335 | { |
| 1336 | MMERR("ERR %s seralize key fail.ret %d len %d",__func__,ret,r_len); |
| 1337 | if(out) { OPENSSL_free(out),out=NULL;} |
| 1338 | return CRYPT_ERR_INVALID_PARAM; |
| 1339 | } |
| 1340 | pKeyString->assign((const char*)out,r_len); |
| 1341 | if(out) { OPENSSL_free(out),out=NULL;} |
| 1342 | return CRYPT_OK; |
| 1343 | } |
| 1344 | |
| 1345 | int ECPriKeyToString(EC_KEY* pPriKey, std::string* pKeyString) |
| 1346 | { |
no test coverage detected