tests: add tests for ecdsa.verify

This commit is contained in:
Daniel Cousens 2014-10-11 13:47:32 +11:00
parent 98bc1685b3
commit 10630873eb
3 changed files with 24 additions and 20 deletions

View file

@ -76,14 +76,6 @@ function sign(curve, hash, d) {
return new ECSignature(r, s)
}
function verify(curve, hash, signature, Q) {
// 1.4.2 H = Hash(M), already done by the user
// 1.4.3 e = H
var e = BigInteger.fromBuffer(hash)
return verifyRaw(curve, e, signature, Q)
}
function verifyRaw(curve, e, signature, Q) {
var n = curve.n
var G = curve.G
@ -114,6 +106,14 @@ function verifyRaw(curve, e, signature, Q) {
return v.equals(r)
}
function verify(curve, hash, signature, Q) {
// 1.4.2 H = Hash(M), already done by the user
// 1.4.3 e = H
var e = BigInteger.fromBuffer(hash)
return verifyRaw(curve, e, signature, Q)
}
/**
* Recover a public key from a signature.
*