Skip to content

Commit

Permalink
added fix for elliptic recovery bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wanderer committed Jan 18, 2016
1 parent fe8a988 commit 58b9e7b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/elliptic/recover.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ exports.recoverSync = function (msg, signature, recovery) {
try {
var sigObj = {r: signature.slice(0, 32), s: signature.slice(32, 64)}
var pubKey = ec.recoverPubKey(msg, sigObj, recovery)
if (!ec.verify(msg, sigObj, pubKey)) {
throw new Error(messages.ECDSA_RECOVER_FAIL)
}

return new Buffer(pubKey.encodeCompressed())
} catch (err) {
throw new Error(messages.ECDSA_RECOVER_FAIL)
Expand Down

0 comments on commit 58b9e7b

Please sign in to comment.