mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
CKey::SetPubKey(const std::string&);
This commit is contained in:
16
src/key.h
16
src/key.h
@@ -221,16 +221,26 @@ public:
|
||||
return vchPrivKey;
|
||||
}
|
||||
|
||||
bool SetPubKey(const std::vector<unsigned char>& vchPubKey)
|
||||
bool SetPubKey(const void *ptr, size_t len)
|
||||
{
|
||||
const unsigned char* pbegin = &vchPubKey[0];
|
||||
if (!o2i_ECPublicKey(&pkey, &pbegin, vchPubKey.size()))
|
||||
const unsigned char* pbegin = static_cast<const unsigned char *>(ptr);
|
||||
if (!o2i_ECPublicKey(&pkey, &pbegin, len))
|
||||
return false;
|
||||
EC_KEY_set_conv_form(pkey, POINT_CONVERSION_COMPRESSED);
|
||||
fSet = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetPubKey(const std::vector<unsigned char>& vchPubKey)
|
||||
{
|
||||
return SetPubKey(&vchPubKey[0], vchPubKey.size());
|
||||
}
|
||||
|
||||
bool SetPubKey(const std::string& pubKey)
|
||||
{
|
||||
return SetPubKey(pubKey.data(), pubKey.size());
|
||||
}
|
||||
|
||||
std::vector<unsigned char> GetPubKey() const
|
||||
{
|
||||
unsigned int nSize = i2o_ECPublicKey(pkey, NULL);
|
||||
|
||||
Reference in New Issue
Block a user