aboutsummaryrefslogtreecommitdiff
path: root/src/key.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-11-06 01:17:48 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2014-11-23 10:47:39 +0100
commitd0c41a73501a0bf94fca91be5fb38ab039490843 (patch)
tree46da9cfe49a652b7853fcb3d1fb4ba0e6c52a9d7 /src/key.h
parentcbf28c6619fe348a258dfd7d08bdbd2392d07511 (diff)
downloadbitcoin-d0c41a73501a0bf94fca91be5fb38ab039490843.tar.xz
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/key.h')
-rw-r--r--src/key.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/key.h b/src/key.h
index 0bb05482c9..d8c82b6f09 100644
--- a/src/key.h
+++ b/src/key.h
@@ -136,6 +136,12 @@ public:
//! Derive BIP32 child key.
bool Derive(CKey& keyChild, unsigned char ccChild[32], unsigned int nChild, const unsigned char cc[32]) const;
+ /**
+ * Verify thoroughly whether a private key and a public key match.
+ * This is done using a different mechanism than just regenerating it.
+ */
+ bool VerifyPubKey(const CPubKey& vchPubKey) const;
+
//! Load private key and check that public key matches.
bool Load(CPrivKey& privkey, CPubKey& vchPubKey, bool fSkipCheck);