SRP tests
This commit is contained in:
parent
b3e81f4e78
commit
909a503be0
|
@ -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();
|
||||
});
|
|
@ -0,0 +1,9 @@
|
|||
/* Official SRP test vectors. */
|
||||
sjcl.test.vector.srp = [
|
||||
{ I: "alice",
|
||||
P: "password123",
|
||||
s: "BEB25379D1A8581EB5A727673A2441EE",
|
||||
v: "7E273DE8696FFC4F4E337D05B4B375BEB0DDE1569E8FA00A9886D8129BADA1F1822223CA1A605B530E379BA4729FDC59F105B4787E5186F5C671085A1447B52A48CF1970B4FB6F8400BBF4CEBFBB168152E08AB5EA53D15C1AFF87B2B9DA6E04E058AD51CC72BFC9033B564E26480D78E955A5E29E7AB245DB2BE315E2099AFB",
|
||||
known_group_size: 1024
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue