author | Michael Krelin <hacker@klever.net> | 2014-06-30 18:20:13 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2014-06-30 18:20:13 (UTC) |
commit | c392fe28606eefa0c814e5c25d641f5ffe623186 (patch) (unidiff) | |
tree | da03fe13ca09fadbebbad9b5d38750757270bae8 /frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | |
parent | d341307d346dee62ee36b27f0f93b8f000748a96 (diff) | |
parent | 6dd16d9359e3a4dc306802588b09acd43947a606 (diff) | |
download | clipperz-c392fe28606eefa0c814e5c25d641f5ffe623186.zip clipperz-c392fe28606eefa0c814e5c25d641f5ffe623186.tar.gz clipperz-c392fe28606eefa0c814e5c25d641f5ffe623186.tar.bz2 |
Merge remote-tracking branch 'github/master' into nmaster
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js index b806cb7..e5f68a8 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | |||
@@ -37,5 +37,5 @@ Clipperz.PM.Proxy.Offline.DataStore = function(args) { | |||
37 | this._tolls = {}; | 37 | this._tolls = {}; |
38 | this._currentStaticConnection = null; | 38 | this._currentStaticConnection = null; |
39 | 39 | ||
40 | return this; | 40 | return this; |
41 | } | 41 | } |
@@ -292,5 +292,5 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
292 | } | 292 | } |
293 | } else { | 293 | } else { |
294 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 294 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
295 | } | 295 | } |
296 | 296 | ||
@@ -299,5 +299,5 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
299 | 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'], | 299 | 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'], |
300 | 'result':'done' | 300 | 'result':'done' |
301 | }, | 301 | }, |
302 | toll: this.getTollForRequestType('CONNECT') | 302 | toll: this.getTollForRequestType('CONNECT') |
303 | } | 303 | } |
@@ -330,5 +330,5 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
330 | aConnection['b'] = new Clipperz.Crypto.BigInt(randomBytes, 16); | 330 | aConnection['b'] = new Clipperz.Crypto.BigInt(randomBytes, 16); |
331 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); | 331 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); |
332 | aConnection['B'] = v.add(Clipperz.Crypto.SRP.g().powerModule(aConnection['b'], Clipperz.Crypto.SRP.n())); | 332 | aConnection['B'] = (Clipperz.Crypto.SRP.k().multiply(v)).add(Clipperz.Crypto.SRP.g().powerModule(aConnection['b'], Clipperz.Crypto.SRP.n())); |
333 | 333 | ||
334 | aConnection['A'] = someParameters.parameters.A; | 334 | aConnection['A'] = someParameters.parameters.A; |
@@ -339,18 +339,33 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
339 | nextTollRequestType = 'CONNECT'; | 339 | nextTollRequestType = 'CONNECT'; |
340 | } else if (someParameters.message == "credentialCheck") { | 340 | } else if (someParameters.message == "credentialCheck") { |
341 | var v, u, S, A, K, M1; | 341 | var v, u, s, S, A, K, M1; |
342 | 342 | var stringHash = function (aValue) { | |
343 | return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aValue)).toHexString().substring(2); | ||
344 | }; | ||
345 | |||
343 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); | 346 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); |
344 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aConnection['B'].asString(10))).toHexString(), 16); | ||
345 | A = new Clipperz.Crypto.BigInt(aConnection['A'], 16); | 347 | A = new Clipperz.Crypto.BigInt(aConnection['A'], 16); |
348 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + aConnection['B'].asString(10))).toHexString(), 16); | ||
349 | s = new Clipperz.Crypto.BigInt(aConnection['userData']['s'], 16); | ||
346 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(aConnection['b'], Clipperz.Crypto.SRP.n()); | 350 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(aConnection['b'], Clipperz.Crypto.SRP.n()); |
347 | 351 | ||
348 | K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(S.asString(10))).toHexString().slice(2); | 352 | K = stringHash(S.asString(10)); |
349 | 353 | ||
350 | M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + aConnection['B'].asString(10) + K)).toHexString().slice(2); | 354 | M1 = stringHash( |
355 | "597626870978286801440197562148588907434001483655788865609375806439877501869636875571920406529" + | ||
356 | stringHash(aConnection['C']) + | ||
357 | s.asString(10) + | ||
358 | A.asString(10) + | ||
359 | aConnection['B'].asString(10) + | ||
360 | K | ||
361 | ); | ||
351 | if (someParameters.parameters.M1 == M1) { | 362 | if (someParameters.parameters.M1 == M1) { |
352 | var M2; | 363 | var M2; |
353 | 364 | ||
354 | M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + someParameters.parameters.M1 + K)).toHexString().slice(2); | 365 | M2 = stringHash( |
366 | A.asString(10) + | ||
367 | someParameters.parameters.M1 + | ||
368 | K | ||
369 | ); | ||
355 | result['M2'] = M2; | 370 | result['M2'] = M2; |
356 | } else { | 371 | } else { |