mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Allow signatures, public keys, and private keys to vary in length. If this
breaks anything, we'll fix it.
This commit is contained in:
@@ -218,7 +218,6 @@ public:
|
|||||||
if (i2d_ECPrivateKey(pkey, &pbegin) != nSize)
|
if (i2d_ECPrivateKey(pkey, &pbegin) != nSize)
|
||||||
throw key_error("CKey::GetPrivKey() : i2d_ECPrivateKey returned unexpected size");
|
throw key_error("CKey::GetPrivKey() : i2d_ECPrivateKey returned unexpected size");
|
||||||
assert(vchPrivKey.size()<=279);
|
assert(vchPrivKey.size()<=279);
|
||||||
while(vchPrivKey.size()<279) vchPrivKey.push_back((unsigned char)0);
|
|
||||||
return vchPrivKey;
|
return vchPrivKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +242,6 @@ public:
|
|||||||
if (i2o_ECPublicKey(pkey, &pbegin) != nSize)
|
if (i2o_ECPublicKey(pkey, &pbegin) != nSize)
|
||||||
throw key_error("CKey::GetPubKey() : i2o_ECPublicKey returned unexpected size");
|
throw key_error("CKey::GetPubKey() : i2o_ECPublicKey returned unexpected size");
|
||||||
assert(vchPubKey.size()<=33);
|
assert(vchPubKey.size()<=33);
|
||||||
while(vchPubKey.size()<33) vchPubKey.push_back((unsigned char)0);
|
|
||||||
return vchPubKey;
|
return vchPubKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,12 +253,6 @@ public:
|
|||||||
if (!ECDSA_sign(0, (unsigned char*)&hash, sizeof(hash), pchSig, &nSize, pkey))
|
if (!ECDSA_sign(0, (unsigned char*)&hash, sizeof(hash), pchSig, &nSize, pkey))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while(nSize<72)
|
|
||||||
{ // enlarge to 72 bytes
|
|
||||||
pchSig[nSize]=0;
|
|
||||||
nSize++;
|
|
||||||
}
|
|
||||||
assert(nSize==72);
|
|
||||||
vchSig.resize(nSize);
|
vchSig.resize(nSize);
|
||||||
memcpy(&vchSig[0], pchSig, nSize);
|
memcpy(&vchSig[0], pchSig, nSize);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user