From 44ddce8d5fc67e3cb0726aa0707502d82c117122 Mon Sep 17 00:00:00 2001 From: Quinn Slack Date: Tue, 19 Apr 2011 05:14:28 -0700 Subject: [PATCH] test srp x and v --- test/srp_test.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/srp_test.js b/test/srp_test.js index bbbd9281..d5219e72 100644 --- a/test/srp_test.js +++ b/test/srp_test.js @@ -5,15 +5,18 @@ new sjcl.test.TestCase("SRP known-answer (RFC 5054) tests", function (cb) { return; } - var i, kat = sjcl.test.vector.srp, tv, N, g, v; + var i, kat = sjcl.test.vector.srp, tv, N, g, v, x; for (i=0; i v = " + v); - this.require(sjcl.bitArray.equal(v, tv.v), "srpv #"+i); + N = sjcl.keyexchange.srp.knownGroup(tv.known_group_size).N; + g = sjcl.keyexchange.srp.knownGroup(tv.known_group_size).g; + tv.s = sjcl.codec.hex.toBits(tv.s); + x = sjcl.keyexchange.srp.makeX(tv.I, tv.P, tv.s); + this.require(sjcl.codec.hex.fromBits(x).toUpperCase() === tv.x, "srpx #"+i); + + v = sjcl.keyexchange.srp.makeVerifier(tv.I, tv.P, tv.s, N, g); + this.require(v.equals(new sjcl.bn(tv.v)), "srpv #"+i); } cb && cb(); });