mirror of
https://github.com/hanzoai/elliptic.git
synced 2026-09-23 23:51:03 +00:00
ec: use isSecondKey in recoverPubKey
This commit is contained in:
@@ -186,8 +186,12 @@ EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
|
||||
throw new Error('Unable to find sencond key candinate');
|
||||
|
||||
// 1.1. Let x = r + jn.
|
||||
r = this.curve.pointFromX(r, isYOdd);
|
||||
var eNeg = e.neg().umod(n);
|
||||
if (isSecondKey)
|
||||
r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
|
||||
else
|
||||
r = this.curve.pointFromX(r, isYOdd);
|
||||
|
||||
var eNeg = n.sub(e);
|
||||
|
||||
// 1.6.1 Compute Q = r^-1 (sR - eG)
|
||||
// Q = r^-1 (sR + -eG)
|
||||
|
||||
Reference in New Issue
Block a user