Allow signatures, public keys, and private keys to vary in length. If this

breaks anything, we'll fix it.
This commit is contained in:
JoelKatz
2012-05-18 19:45:55 -07:00
parent b773fbbc90
commit ce60836ac4

View File

@@ -218,7 +218,6 @@ public:
if (i2d_ECPrivateKey(pkey, &pbegin) != nSize)
throw key_error("CKey::GetPrivKey() : i2d_ECPrivateKey returned unexpected size");
assert(vchPrivKey.size()<=279);
while(vchPrivKey.size()<279) vchPrivKey.push_back((unsigned char)0);
return vchPrivKey;
}
@@ -243,7 +242,6 @@ public:
if (i2o_ECPublicKey(pkey, &pbegin) != nSize)
throw key_error("CKey::GetPubKey() : i2o_ECPublicKey returned unexpected size");
assert(vchPubKey.size()<=33);
while(vchPubKey.size()<33) vchPubKey.push_back((unsigned char)0);
return vchPubKey;
}
@@ -255,12 +253,6 @@ public:
if (!ECDSA_sign(0, (unsigned char*)&hash, sizeof(hash), pchSig, &nSize, pkey))
return false;
while(nSize<72)
{ // enlarge to 72 bytes
pchSig[nSize]=0;
nSize++;
}
assert(nSize==72);
vchSig.resize(nSize);
memcpy(&vchSig[0], pchSig, nSize);
return true;