diff --git a/src/key.h b/src/key.h index e7c5a3e8a..999bc1e81 100644 --- a/src/key.h +++ b/src/key.h @@ -221,16 +221,26 @@ public: return vchPrivKey; } - bool SetPubKey(const std::vector& 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(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& vchPubKey) + { + return SetPubKey(&vchPubKey[0], vchPubKey.size()); + } + + bool SetPubKey(const std::string& pubKey) + { + return SetPubKey(pubKey.data(), pubKey.size()); + } + std::vector GetPubKey() const { unsigned int nSize = i2o_ECPublicKey(pkey, NULL);