MCPcopy Create free account
hub / github.com/Tencent/mars / ECPubKeyToString

Function ECPubKeyToString

mars/openssl/export/crypto/iCoreCrypt.cpp:1323–1343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1321}
1322
1323int 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
1345int ECPriKeyToString(EC_KEY* pPriKey, std::string* pKeyString)
1346{

Callers 2

ECKeyToStringFunction · 0.85
ComputerEcdhKeyWrapperFunction · 0.85

Calls 1

assignMethod · 0.45

Tested by

no test coverage detected