Skip to content

Commit

Permalink
k should be 32 bytes, not 8 bytes
Browse files Browse the repository at this point in the history
This is a bug with security implications. It is much easier to guess the value
of k within a 64 byte range. This would lead to compromised private keys.

The cryptography interface of bitcore is extremely poor. I recommend:
* Get rid of the C++ code, since it makes everything more difficult with little benefit
* Refactor all crypto, and have easily auditable bignum, point, ecdsa, and key classes
* Then actually audit the crypto
  • Loading branch information
Ryan X. Charles committed Aug 11, 2014
1 parent d9ffe75 commit 9f9e2f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/common/Key.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ Key.calcPubKeyRecoveryParam = function(e, r, s, Q) {

Key.genk = function() {
//TODO: account for when >= n
return new bignum(SecureRandom.getRandomBuffer(8));
var k = new bignum(SecureRandom.getRandomBuffer(32))
return k;
};

module.exports = Key;

0 comments on commit 9f9e2f1

Please sign in to comment.