From 4e1f43565590afebf4e828b5723bf4f5358c51e1 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 21 May 2012 06:04:51 -0700 Subject: [PATCH] CKey::SetPubKey(const std::string&); --- src/key.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/key.h b/src/key.h index e7c5a3e8a9..999bc1e81b 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);