diff options
| author | Pieter Wuille <[email protected]> | 2014-11-06 01:17:48 -0800 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2014-11-23 10:47:39 +0100 |
| commit | d0c41a73501a0bf94fca91be5fb38ab039490843 (patch) | |
| tree | 46da9cfe49a652b7853fcb3d1fb4ba0e6c52a9d7 /src/rpcdump.cpp | |
| parent | Merge pull request #5350 (diff) | |
| download | discoin-d0c41a73501a0bf94fca91be5fb38ab039490843.tar.xz discoin-d0c41a73501a0bf94fca91be5fb38ab039490843.zip | |
Add sanity check after key generation
Add a sanity check to prevent cosmic rays from flipping a bit in the
generated public key, or bugs in the elliptic curve code. This is
simply done by signing a (randomized) message, and verifying the
result.
Diffstat (limited to 'src/rpcdump.cpp')
| -rw-r--r-- | src/rpcdump.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index c3ffe38cc..8b95373cf 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -112,6 +112,7 @@ Value importprivkey(const Array& params, bool fHelp) if (!key.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range"); CPubKey pubkey = key.GetPubKey(); + assert(key.VerifyPubKey(pubkey)); CKeyID vchAddress = pubkey.GetID(); { pwalletMain->MarkDirty(); @@ -253,6 +254,7 @@ Value importwallet(const Array& params, bool fHelp) continue; CKey key = vchSecret.GetKey(); CPubKey pubkey = key.GetPubKey(); + assert(key.VerifyPubKey(pubkey)); CKeyID keyid = pubkey.GetID(); if (pwalletMain->HaveKey(keyid)) { LogPrintf("Skipping import of %s (key already present)\n", CBitcoinAddress(keyid).ToString()); |