SRP tests

This commit is contained in:
Quinn Slack
2011-04-19 01:43:21 -07:00
parent b3e81f4e78
commit 909a503be0
2 changed files with 28 additions and 0 deletions

19
test/srp_test.js Normal file
View File

@@ -0,0 +1,19 @@
new sjcl.test.TestCase("SRP known-answer (RFC 5054) tests", function (cb) {
if (!sjcl.keyexchange.srp) {
this.unimplemented();
cb && cb();
return;
}
var i, kat = sjcl.test.vector.srp, tv, N, g, v;
for (i=0; i<kat.length; i++) {
tv = kat[i];
N = sjcl.keyexchange.srp.knownGroups[tv.known_group_size].N;
g = sjcl.keyexchange.srp.knownGroups[tv.known_group_size].g;
v = sjcl.keyexchange.srp.makeVerifier(tv.I, tv.P, tv.s, N, g)
print("-> v = " + v);
this.require(sjcl.bitArray.equal(v, tv.v), "srpv #"+i);
}
cb && cb();
});