mirror of
http://git.whoc.org.uk/git/password-manager.git
synced 2025-11-03 12:37:36 +01:00
First version of the newly restructured repository
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.BookmarkletProcessor - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../js/JSON/json2.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/BookmarkletProcessor.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="BookmarkletProcessor.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
function testBookmarkletConfigurationString (aConfiguration, shouldFail, aMessage) {
|
||||
// var configuration;
|
||||
|
||||
//try {
|
||||
// configuration = Clipperz.Base.evalJSON(aConfiguration);
|
||||
//} catch (exception) {
|
||||
// console.log("EXCEPTION", exception);
|
||||
// throw exception;
|
||||
//}
|
||||
|
||||
//console.log("configuration", configuration);
|
||||
|
||||
if (shouldFail == true) {
|
||||
try {
|
||||
Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration(aConfiguration);
|
||||
SimpleTest.ok(false, "vulnerability not caught - " + aMessage);
|
||||
} catch(exception) {
|
||||
SimpleTest.ok(true, "vulnerability correctly caught - " + aMessage);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration(aConfiguration);
|
||||
SimpleTest.ok(true, "configuration correctly checked - " + aMessage);
|
||||
} catch(exception) {
|
||||
SimpleTest.ok(false, "configuration wrongly caught as malicious - " + aMessage);
|
||||
// console.log(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
|
||||
var tests = {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'simpleAmazonConfiguration_test': function () {
|
||||
var bookmarkletConfigurationString;
|
||||
|
||||
bookmarkletConfigurationString = "{"+
|
||||
"\"page\": {\"title\": \"Sign In\"},\n" +
|
||||
"\"form\": {" +
|
||||
"\"attributes\": {" +
|
||||
"\"action\": \"https://www.amazon.com/gp/flex/sign-in/select.html\",\n" +
|
||||
"\"method\": \"post\"" +
|
||||
"},\n" +
|
||||
"\"inputs\": [" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"path\",\n\"value\": \"/gp/yourstore\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"useRedirectOnSuccess\",\n\"value\": \"1\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"query\",\n\"value\": \"signIn=1&action=sign-out&useRedirectOnSuccess=1&path=/gp/yourstore&ref_=pd_irl_gw_r\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"mode\",\n\"value\": \"\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"redirectProtocol\",\n\"value\": \"\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"pageAction\",\n\"value\": \"/gp/yourstore\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"disableCorpSignUp\",\n\"value\": \"\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"protocol\",\n\"value\": \"https\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"sessionId\",\n\"value\": \"105-1479357-7902864\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"referer\",\n\"value\": \"flex\"},\n" +
|
||||
"{\"type\": \"text\",\n\"name\": \"email\",\n\"value\": \"\"},\n" +
|
||||
"{\"type\": \"password\",\n\"name\": \"password\",\n\"value\": \"\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"metadata1\",\n\"value\": \"Firefox 3.0.3 Mac\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"metadataf1\",\n\"value\": \"\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"metadata2\",\n\"value\": \"Default Plug-in Java Embedding Plugin 0.9.6.4 Shockwave Flash 90124RealPlayer Plugin QuickTime Plug-in 7.5.5 Flip4Mac Windows Media Plugin 2.2 4||1440-900-878-24-*-*-*\"},\n" +
|
||||
"{\"type\": \"hidden\",\n\"name\": \"metadata3\",\n\"value\": \"timezone: -1 execution time: 3\"},\n" +
|
||||
"{\"name\": \"action\",\n\"type\": \"radio\",\n\"options\": [" +
|
||||
"{\"value\": \"new-user\",\n\"checked\": false},\n" +
|
||||
"{\"value\": \"sign-in\",\n\"checked\": true}" +
|
||||
"]}" +
|
||||
"]" +
|
||||
"},\n" +
|
||||
"\"version\": \"0.2.3\"" +
|
||||
"}";
|
||||
testBookmarkletConfigurationString(bookmarkletConfigurationString, false, "regular Amazon.com configuration");
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'hackedConfigurationWithXSSAttackVectorReadyToBeTriggeredWhenActivatingTheDirectLogin_test': function () {
|
||||
var bookmarkletConfigurationString;
|
||||
|
||||
bookmarkletConfigurationString = "{" +
|
||||
"\"page\": {\"title\": \"Example Attack\"}," +
|
||||
"\"form\": { " +
|
||||
"\"attributes\": { " +
|
||||
"\"action\": \"javascript:opener.document.body.innerHTML = 'hacked!';close();\", " +
|
||||
"\"style\": \"-moz-binding:url('http://ha.ckers.org/xssmoz.xml#xss')\", " +
|
||||
"\"method\": null " +
|
||||
"}, " +
|
||||
"\"inputs\": [" +
|
||||
"{\"type\": \"text\", \"name\": \"username\", \"value\": \"\"}, " +
|
||||
"{\"type\": \"password\", \"name\": \"password\", \"value\": \"\"}" +
|
||||
"]" +
|
||||
"}," +
|
||||
"\"version\": \"0.2.3\" " +
|
||||
"}";
|
||||
testBookmarkletConfigurationString(bookmarkletConfigurationString, false, "hacked configuration that is trying to inject a XSS attack vector. It should not fail, as it is responsability of the direct login to avoid triggering such attack vector");
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.BookmarkletProcessor", tests, {trace:false});
|
||||
841
frontend/gamma/tests/tests/Clipperz/PM/Connection.data.js
Normal file
841
frontend/gamma/tests/tests/Clipperz/PM/Connection.data.js
Normal file
File diff suppressed because one or more lines are too long
71
frontend/gamma/tests/tests/Clipperz/PM/Connection.html
Normal file
71
frontend/gamma/tests/tests/Clipperz/PM/Connection.html
Normal file
@@ -0,0 +1,71 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.Connection - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../js/JSON/json2.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy/Proxy.Offline.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy/Proxy.Test.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="Connection.data.js"></script>
|
||||
<script type="text/javascript" src="Connection.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
255
frontend/gamma/tests/tests/Clipperz/PM/Connection.test.js
Normal file
255
frontend/gamma/tests/tests/Clipperz/PM/Connection.test.js
Normal file
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'simple_tests': function () {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("simple_tests", {trace:false});
|
||||
deferredResult.addCallback(function() {
|
||||
var connection;
|
||||
|
||||
SimpleTest.is(Clipperz.PM.Connection.communicationProtocol.versions['current'], Clipperz.PM.Connection.SRP['1.1'], "the current connection is 1.1");
|
||||
|
||||
connection = new Clipperz.PM.Connection.communicationProtocol.versions['current']();
|
||||
SimpleTest.ok(connection != null, "can create a connection with the 'current' communication protocol");
|
||||
|
||||
SimpleTest.is(connection.proxy(), Clipperz.PM.Proxy.defaultProxy, "the connection uses the defaultProxy if no proxy is specified on the constructor");
|
||||
});
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'simpleProxy_tests': function () {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("simple_tests", {trace:false});
|
||||
deferredResult.addCallback(function() {
|
||||
var connection;
|
||||
var proxy;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy();
|
||||
connection = new Clipperz.PM.Connection.communicationProtocol.versions['current']({proxy:proxy});
|
||||
SimpleTest.is(connection.proxy(), proxy, "the connection uses the specified proxy, when present");
|
||||
});
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'login_test': function () {
|
||||
var deferredResult;
|
||||
var connection;
|
||||
var proxy;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:false, shouldCheckExpectedRequests:true});
|
||||
connection = new Clipperz.PM.Connection.communicationProtocol.versions['current']({
|
||||
proxy: proxy,
|
||||
getCredentialsFunction: function() { return {username:'joe', password:'clipperz'}; }
|
||||
});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("login_tests", {trace:false});
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addCallback(function() {
|
||||
proxy.expectedRequests().unshift({
|
||||
name: "First handshake step",
|
||||
functionName: 'handshake',
|
||||
parameters: {
|
||||
parameters: {
|
||||
message: MochiKit.Base.partial(MochiKit.Base.operator.eq, "connect"),
|
||||
version: MochiKit.Base.partial(MochiKit.Base.operator.eq, "0.2"),
|
||||
parameters: {
|
||||
C: MochiKit.Base.partial(MochiKit.Base.operator.eq, "f527cdd90d0d47f8524b4e165398ad1455eba515d04abd101d1e93b3c6ae0674"),
|
||||
A: MochiKit.Base.operator.truth
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
deferredResult.addCallback(function() {
|
||||
proxy.expectedRequests().unshift({
|
||||
name: "Second handshake step",
|
||||
functionName: 'handshake',
|
||||
parameters: {
|
||||
parameters: {
|
||||
message: MochiKit.Base.partial(MochiKit.Base.operator.eq, "credentialCheck"),
|
||||
version: MochiKit.Base.partial(MochiKit.Base.operator.eq, "0.2"),
|
||||
parameters: {
|
||||
M1: MochiKit.Base.operator.truth
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
deferredResult.addMethod(connection, 'login'/*, 'joe', 'clipperz'*/);
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
SimpleTest.is(aResult.result, 'done', "successfully logged in");
|
||||
})
|
||||
deferredResult.addErrback(SimpleTest.ok, false, "the login procedure should succeed, and NOT going through this code path");
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'login_with_toll_test': function () {
|
||||
var deferredResult;
|
||||
var connection;
|
||||
var proxy;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, shouldCheckExpectedRequests:true});
|
||||
connection = new Clipperz.PM.Connection.communicationProtocol.versions['current']({
|
||||
proxy:proxy,
|
||||
getCredentialsFunction: function() { return {username:'joe', password:'clipperz'}; }
|
||||
});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("login_with_toll_test", {trace:false});
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addCallback(function() {
|
||||
proxy.expectedRequests().unshift({
|
||||
name: "knock step",
|
||||
functionName: 'knock',
|
||||
parameters: {
|
||||
requestType: MochiKit.Base.partial(MochiKit.Base.operator.eq, "CONNECT")
|
||||
}
|
||||
});
|
||||
});
|
||||
deferredResult.addCallback(function() {
|
||||
proxy.expectedRequests().unshift({
|
||||
name: "First handshake step",
|
||||
functionName: 'handshake',
|
||||
parameters: {
|
||||
parameters: {
|
||||
message: MochiKit.Base.partial(MochiKit.Base.operator.eq, "connect"),
|
||||
version: MochiKit.Base.partial(MochiKit.Base.operator.eq, "0.2"),
|
||||
parameters: {
|
||||
C: MochiKit.Base.partial(MochiKit.Base.operator.eq, "f527cdd90d0d47f8524b4e165398ad1455eba515d04abd101d1e93b3c6ae0674"),
|
||||
A: MochiKit.Base.operator.truth
|
||||
}
|
||||
},
|
||||
toll: {
|
||||
targetValue: MochiKit.Base.operator.truth,
|
||||
toll: MochiKit.Base.operator.truth
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
deferredResult.addCallback(function() {
|
||||
proxy.expectedRequests().unshift({
|
||||
name: "Second handshake step",
|
||||
functionName: 'handshake',
|
||||
parameters: {
|
||||
parameters: {
|
||||
message: MochiKit.Base.partial(MochiKit.Base.operator.eq, "credentialCheck"),
|
||||
version: MochiKit.Base.partial(MochiKit.Base.operator.eq, "0.2"),
|
||||
parameters: {
|
||||
M1: MochiKit.Base.operator.truth
|
||||
}
|
||||
},
|
||||
toll: {
|
||||
targetValue: MochiKit.Base.operator.truth,
|
||||
toll: MochiKit.Base.operator.truth
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
deferredResult.addMethod(connection, 'login'/*, 'joe', 'clipperz'*/);
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
SimpleTest.is(aResult.result, 'done', "successfully logged in");
|
||||
})
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'getUserDetails_test': function () {
|
||||
var deferredResult;
|
||||
var connection;
|
||||
var proxy;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, shouldCheckExpectedRequests:false});
|
||||
connection = new Clipperz.PM.Connection.communicationProtocol.versions['current']({
|
||||
proxy:proxy,
|
||||
getCredentialsFunction: function() { return {username:'joe', password:'clipperz'}; }
|
||||
});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("getUserDetails_test", {trace:false});
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addMethod(connection, 'login'/*, 'joe', 'clipperz'*/);
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
SimpleTest.is(aResult.result, 'done', "successfully logged in");
|
||||
});
|
||||
deferredResult.addMethod(proxy, 'setShouldCheckExpectedRequests', [
|
||||
{
|
||||
name: "Get user details",
|
||||
functionName: 'message',
|
||||
parameters: {
|
||||
parameters: {
|
||||
message: MochiKit.Base.partial(MochiKit.Base.operator.eq, "getUserDetails"),
|
||||
srpSharedSecret: MochiKit.Base.operator.truth
|
||||
},
|
||||
toll: {
|
||||
targetValue: MochiKit.Base.operator.truth,
|
||||
toll: MochiKit.Base.operator.truth
|
||||
}
|
||||
}
|
||||
}
|
||||
]);
|
||||
deferredResult.addMethod(connection, 'message', 'getUserDetails');
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
SimpleTest.ok(aResult['header'] != null, "got user details - header");
|
||||
SimpleTest.ok(aResult['statistics'] != null, "got user details - statistics");
|
||||
SimpleTest.ok(aResult['version'] == '0.3', "got user details - version");
|
||||
});
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
//#############################################################################
|
||||
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.Connection", tests, {trace:false});
|
||||
281
frontend/gamma/tests/tests/Clipperz/PM/Crypto.html
Normal file
281
frontend/gamma/tests/tests/Clipperz/PM/Crypto.html
Normal file
@@ -0,0 +1,281 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.Crypto - TEST</title>
|
||||
|
||||
<script>
|
||||
jslog_config_enabled = true;
|
||||
clipperz_profiling_enabled = true;
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../js/JSON/json2.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/DOM.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Profile.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
<!--
|
||||
<script>
|
||||
MochiKit.DOM.addLoadEvent(MochiKit.Base.partial(MochiKit.LoggingPane.createLoggingPane, true));
|
||||
MochiKit.Logging.logger.useNativeConsole = true;
|
||||
</script>
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
Clipperz_PM_Crypt_test = function() {
|
||||
var key;
|
||||
|
||||
var plainData;
|
||||
var encryptedData;
|
||||
var decryptedData;
|
||||
|
||||
var result;
|
||||
var expectedResult;
|
||||
|
||||
var plainText;
|
||||
var longPlainText;
|
||||
|
||||
key = 'trustno1';
|
||||
|
||||
plainText = "Lorem ipsum dolor sit amet";
|
||||
longPlainText = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec nunc sapien, condimentum vitae, varius vel, pharetra in, augue. Mauris quam magna, pretium sit amet, accumsan id, volutpat lobortis, nibh. Fusce sagittis. Aenean justo. Curabitur euismod pede. Morbi at ante. Proin nisl leo, ultrices sed, facilisis et, nonummy sit amet, lorem. Praesent mauris tellus, pulvinar sed, nonummy vitae, rhoncus non, nunc. Proin placerat malesuada nisl. Nunc id enim. Maecenas commodo enim ac nibh. Sed condimentum, urna sit amet euismod gravida, mi urna varius odio, luctus pretium lectus justo nec felis. Ut in augue et est malesuada rhoncus. Sed vel orci. Mauris suscipit. Praesent cursus velit non turpis. Donec tristique dolor ac est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla est sapien, vulputate eget, bibendum id, pharetra nec, mauris. Aliquam faucibus tincidunt dui. Proin iaculis. Maecenas sagittis. Integer et augue. Donec vitae urna in orci aliquet commodo. Vestibulum lorem sem, suscipit ac, placerat nec, mollis in, felis. Donec laoreet odio a mauris. Integer rutrum, sapien id varius molestie, mauris odio egestas orci, non bibendum sem felis in metus. Phasellus consectetuer lectus adipiscing mauris. Ut magna tellus, euismod ac, suscipit tincidunt, ullamcorper adipiscing, massa. Etiam orci. Phasellus a urna. Cras neque quam, laoreet at, tempus eget, euismod nec, nibh. Etiam hendrerit. Aenean vel lorem. Ut ligula lacus, congue eu, lobortis sit amet, venenatis in, magna. Nullam cursus felis quis est. Sed sem est, condimentum eu, vestibulum a, mattis vel, diam. Curabitur tincidunt pede quis pede. Sed neque diam, convallis vel, luctus at, porta id, nisl. Suspendisse potenti. Sed volutpat lobortis orci. Praesent mi. In interdum. Suspendisse suscipit ipsum eget dolor. Curabitur et tellus sed velit hendrerit varius. Cras sit amet est. Donec arcu nulla, vehicula et, pretium in, placerat id, felis. Integer mollis auctor lectus. Integer ultrices elementum sapien. Nam et erat. Nam pulvinar porta tortor. Nam at risus. Quisque nulla. Integer vestibulum, lacus id bibendum laoreet, ligula mi pharetra lorem, sit amet pharetra felis mauris quis justo. Aliquam ultricies. Duis a pede eget lorem dapibus rhoncus. Aenean eu elit non libero consectetuer viverra. Maecenas velit mi, eleifend vel, malesuada vel, condimentum quis, odio. Mauris tempus augue sed turpis. Pellentesque condimentum, lacus vitae pellentesque ultricies, risus tellus posuere nisi, et dictum turpis pede nec elit. Sed eu lectus eu justo sagittis euismod. Vestibulum lobortis, urna id mollis rhoncus, orci quam euismod ligula, at malesuada lacus magna vitae massa. Phasellus mattis fermentum velit. Nulla vulputate consequat enim. Maecenas quis neque. Curabitur sagittis facilisis neque. In elementum, eros non porttitor rhoncus, libero turpis sodales odio, vitae porta tellus purus et ante. Nullam molestie sollicitudin metus. Donec a elit. Morbi ut lacus. Donec at arcu. Quisque velit diam, interdum a, lacinia at, varius et, odio. Cras neque magna, ornare id, sollicitudin id, consequat a, est. Phasellus vestibulum est at leo. Nam facilisis, nulla dapibus condimentum pellentesque, est magna viverra ligula, at sollicitudin urna augue ut sapien. Fusce justo.";
|
||||
|
||||
//
|
||||
// hashing
|
||||
//
|
||||
plainData = new Clipperz.ByteArray(plainText);
|
||||
|
||||
result = Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].hash(plainData);
|
||||
is(result.length(), (256/8), "encryptingFunctions.versions[0.1].hash generate a 256 bit signature with a short text");
|
||||
|
||||
result = Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].hash(plainData);
|
||||
is(result.length(), (256/8), "encryptingFunctions.versions[0.2].hash generate a 256 bit signature with a short text");
|
||||
|
||||
|
||||
plainData = new Clipperz.ByteArray(longPlainText);
|
||||
|
||||
result = Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].hash(plainData);
|
||||
is(result.length(), (256/8), "encryptingFunctions.versions[0.1].hash generate a 256 bit signature with a long text");
|
||||
|
||||
result = Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].hash(plainData);
|
||||
is(result.length(), (256/8), "encryptingFunctions.versions[0.2].hash generate a 256 bit signature with a long text");
|
||||
|
||||
|
||||
//
|
||||
// encrypting / decripting
|
||||
//
|
||||
plainData = plainText;
|
||||
|
||||
encryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].encrypt(key, plainData);
|
||||
decryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].decrypt(key, encryptedData);
|
||||
is(plainData.toString(), decryptedData.toString(), "encryptingFunctions.versions[0.1] of encrypt/decrypt functions work with a short text");
|
||||
|
||||
encryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].encrypt(key, plainData);
|
||||
decryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].decrypt(key, encryptedData);
|
||||
is(plainData.toString(), decryptedData.toString(), "encryptingFunctions.versions[0.2] of encrypt/decrypt functions work with a short text");
|
||||
|
||||
//console.time("encrypt-256-short");
|
||||
encryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.3'].encrypt(key, plainData);
|
||||
//console.timeEnd("encrypt-256-short");
|
||||
//console.time("decrypt-256-short");
|
||||
decryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.3'].decrypt(key, encryptedData);
|
||||
//console.timeEnd("decrypt-256-short");
|
||||
is(plainData.toString(), decryptedData.toString(), "encryptingFunctions.versions[0.3] of encrypt/decrypt functions work with a short text");
|
||||
|
||||
|
||||
plainData = longPlainText + longPlainText + longPlainText + longPlainText + longPlainText + longPlainText + longPlainText + longPlainText;
|
||||
|
||||
/*
|
||||
encryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].encrypt(key, plainData);
|
||||
decryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].decrypt(key, encryptedData);
|
||||
is(plainData, decryptedData, "encryptingFunctions.versions[0.1] of encrypt/decrypt functions work with a long text");
|
||||
|
||||
encryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].encrypt(key, plainData);
|
||||
decryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].decrypt(key, encryptedData);
|
||||
is(plainData, decryptedData, "encryptingFunctions.versions[0.2] of encrypt/decrypt functions work with a long text");
|
||||
|
||||
encryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.3'].encrypt(key, plainData);
|
||||
decryptedData = Clipperz.PM.Crypto.encryptingFunctions.versions['0.3'].decrypt(key, encryptedData);
|
||||
is(plainData, decryptedData, "encryptingFunctions.versions[0.3] of encrypt/decrypt functions work with a long text");
|
||||
*/
|
||||
|
||||
{
|
||||
var deferredResult;
|
||||
var startTime;
|
||||
// var nonce;
|
||||
|
||||
// nonce = new Clipperz.ByteArray("0x00000000000000000000000000000000");
|
||||
plainData = plainData + plainData + plainData + plainData + plainData + plainData + plainData + plainData;
|
||||
MochiKit.Logging.logDebug("plainData length: " + plainData.length);
|
||||
startTime = new Date();
|
||||
|
||||
deferredResult = new MochiKit.Async.Deferred();
|
||||
|
||||
deferredResult.addCallback(function() {
|
||||
return Clipperz.PM.Crypto.deferredEncrypt({key:key, value:plainData, version:'0.3'});
|
||||
// return Clipperz.PM.Crypto.encrypt(key, plainData, '0.3' / *Clipperz.PM.Crypto.encryptingFunctions.currentVersion* /);
|
||||
});
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
MochiKit.Logging.logDebug("encrypting: " + (new Date() - startTime));
|
||||
startTime = new Date();
|
||||
return aResult;
|
||||
});
|
||||
deferredResult.addCallback(MochiKit.Async.wait, 1);
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
MochiKit.Logging.logDebug("pause: " + (new Date() - startTime));
|
||||
startTime = new Date();
|
||||
return aResult;
|
||||
});
|
||||
deferredResult.addCallback(function(anEncryptedValue) {
|
||||
return Clipperz.PM.Crypto.deferredDecrypt({key:key, value:anEncryptedValue, version:'0.3'});
|
||||
});
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
MochiKit.Logging.logDebug("decrypting: " + (new Date() - startTime));
|
||||
startTime = new Date();
|
||||
return aResult;
|
||||
});
|
||||
deferredResult.addCallback(MochiKit.Async.wait, 1);
|
||||
deferredResult.addBoth(function(aDecryptedValue) {
|
||||
is(plainData, aDecryptedValue, "deferredEncript/deferredDecript functions work with a long text");
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
var i,c;
|
||||
var currentChar;
|
||||
var unicode;
|
||||
|
||||
unicode = 150;
|
||||
|
||||
c = 100000;
|
||||
startTime = new Date();
|
||||
for (i=0; i<c; i++) {
|
||||
currentChar = String.fromCharCode(unicode+1);
|
||||
}
|
||||
MochiKit.Logging.logDebug("String.fromCharCode: " + (new Date() - startTime));
|
||||
});
|
||||
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
var i,c;
|
||||
var currentByte;
|
||||
var unicode;
|
||||
|
||||
currentByte = 150;
|
||||
|
||||
c = 100000;
|
||||
startTime = new Date();
|
||||
for (i=0; i<c; i++) {
|
||||
unicode = (currentByte & 0x0f) << (6+6);
|
||||
}
|
||||
MochiKit.Logging.logDebug("(currentByte & 0x0f) << (6+6): " + (new Date() - startTime));
|
||||
});
|
||||
|
||||
deferredResult.addCallback(function(aResult) {
|
||||
var i,c;
|
||||
var currentByte;
|
||||
var byteArray;
|
||||
|
||||
currentByte = 150;
|
||||
|
||||
byteArray = new Clipperz.ByteArray(plainData);
|
||||
c = byteArray.length();
|
||||
startTime = new Date();
|
||||
for (i=0; i<c; i++) {
|
||||
currentByte = byteArray.byteAtIndex(i);
|
||||
}
|
||||
MochiKit.Logging.logDebug("byteAtIndex: " + (new Date() - startTime));
|
||||
});
|
||||
*/
|
||||
|
||||
deferredResult.addBoth(function() {
|
||||
SimpleTest.ok(true, "COMPLETED all tests");
|
||||
SimpleTest.finish();
|
||||
})
|
||||
|
||||
deferredResult.callback();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
|
||||
try {
|
||||
MochiKit.Signal.connect(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'readyToGenerateRandomBytes', Clipperz_PM_Crypt_test);
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
} catch (err) {
|
||||
|
||||
var s = "test suite failure!\n";
|
||||
var o = {};
|
||||
var k = null;
|
||||
for (k in err) {
|
||||
// ensure unique keys?!
|
||||
if (!o[k]) {
|
||||
s += k + ": " + err[k] + "\n";
|
||||
o[k] = err[k];
|
||||
}
|
||||
}
|
||||
ok ( false, s );
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,153 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.Crypt - Performance evaluation - TEST</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../js/JSON/json2.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<!--< script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES_other_implementation.js'>< /script> -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
try {
|
||||
var key;
|
||||
var shortText;
|
||||
var longText;
|
||||
var veryLongText;
|
||||
var byteArray;
|
||||
var plainText;
|
||||
var encryptedText;
|
||||
var decryptedText;
|
||||
var startTime, endTime;
|
||||
var startTime1, endTime1;
|
||||
var ClipperzCryptoVersion;
|
||||
var i,c;
|
||||
|
||||
ClipperzCryptoVersion = '0.3';
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
key = 'trustno1';
|
||||
|
||||
shortText = "Lorem ipsum dolor sit amet";
|
||||
longText = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec nunc sapien, condimentum vitae, varius vel, pharetra in, augue. Mauris quam magna, pretium sit amet, accumsan id, volutpat lobortis, nibh. Fusce sagittis. Aenean justo. Curabitur euismod pede. Morbi at ante. Proin nisl leo, ultrices sed, facilisis et, nonummy sit amet, lorem. Praesent mauris tellus, pulvinar sed, nonummy vitae, rhoncus non, nunc. Proin placerat malesuada nisl. Nunc id enim. Maecenas commodo enim ac nibh. Sed condimentum, urna sit amet euismod gravida, mi urna varius odio, luctus pretium lectus justo nec felis. Ut in augue et est malesuada rhoncus. Sed vel orci. Mauris suscipit. Praesent cursus velit non turpis. Donec tristique dolor ac est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla est sapien, vulputate eget, bibendum id, pharetra nec, mauris. Aliquam faucibus tincidunt dui. Proin iaculis. Maecenas sagittis. Integer et augue. Donec vitae urna in orci aliquet commodo. Vestibulum lorem sem, suscipit ac, placerat nec, mollis in, felis. Donec laoreet odio a mauris. Integer rutrum, sapien id varius molestie, mauris odio egestas orci, non bibendum sem felis in metus. Phasellus consectetuer lectus adipiscing mauris. Ut magna tellus, euismod ac, suscipit tincidunt, ullamcorper adipiscing, massa. Etiam orci. Phasellus a urna. Cras neque quam, laoreet at, tempus eget, euismod nec, nibh. Etiam hendrerit. Aenean vel lorem. Ut ligula lacus, congue eu, lobortis sit amet, venenatis in, magna. Nullam cursus felis quis est. Sed sem est, condimentum eu, vestibulum a, mattis vel, diam. Curabitur tincidunt pede quis pede. Sed neque diam, convallis vel, luctus at, porta id, nisl. Suspendisse potenti. Sed volutpat lobortis orci. Praesent mi. In interdum. Suspendisse suscipit ipsum eget dolor. Curabitur et tellus sed velit hendrerit varius. Cras sit amet est. Donec arcu nulla, vehicula et, pretium in, placerat id, felis. Integer mollis auctor lectus. Integer ultrices elementum sapien. Nam et erat. Nam pulvinar porta tortor. Nam at risus. Quisque nulla. Integer vestibulum, lacus id bibendum laoreet, ligula mi pharetra lorem, sit amet pharetra felis mauris quis justo. Aliquam ultricies. Duis a pede eget lorem dapibus rhoncus. Aenean eu elit non libero consectetuer viverra. Maecenas velit mi, eleifend vel, malesuada vel, condimentum quis, odio. Mauris tempus augue sed turpis. Pellentesque condimentum, lacus vitae pellentesque ultricies, risus tellus posuere nisi, et dictum turpis pede nec elit. Sed eu lectus eu justo sagittis euismod. Vestibulum lobortis, urna id mollis rhoncus, orci quam euismod ligula, at malesuada lacus magna vitae massa. Phasellus mattis fermentum velit. Nulla vulputate consequat enim. Maecenas quis neque. Curabitur sagittis facilisis neque. In elementum, eros non porttitor rhoncus, libero turpis sodales odio, vitae porta tellus purus et ante. Nullam molestie sollicitudin metus. Donec a elit. Morbi ut lacus. Donec at arcu. Quisque velit diam, interdum a, lacinia at, varius et, odio. Cras neque magna, ornare id, sollicitudin id, consequat a, est. Phasellus vestibulum est at leo. Nam facilisis, nulla dapibus condimentum pellentesque, est magna viverra ligula, at sollicitudin urna augue ut sapien. Fusce justo.";
|
||||
veryLongText = "";
|
||||
c = 100;
|
||||
for (i=0; i<100; i++) {
|
||||
veryLongText += longText;
|
||||
}
|
||||
nonce = new Clipperz.ByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//
|
||||
// longText encryption performance
|
||||
//
|
||||
//--------------------------------------------------------------
|
||||
|
||||
plainText = longText;
|
||||
|
||||
startTime = new Date();
|
||||
encryptedText = Clipperz.PM.Crypto.encryptingFunctions.versions[ClipperzCryptoVersion].encrypt(key, plainText, nonce);
|
||||
endTime = new Date();
|
||||
//console.log("[1] encryption time: " + (endTime - startTime));
|
||||
is((endTime - startTime < 350), true, "[1] Need to improve some more (" + (endTime - startTime) + ")");
|
||||
is(encryptedText, "AAAAAAAAAAAAAAAAAAAAAOpomXumvlZ1SxHJuJxGPrSK4R7cmkF1cGVGaq0m9nlp6CvZMiV2OKXa714uyy1uvU/2fkYs1weBw76FIdfSLn3i7FtRP1HGH3TCK2BetLMJ3oS+vmYm7XVxpoT6zlOsHDqm8nZL8ubGafCC0Q+EV/YYbABu9kwxP6q3QPywBNJxtEBs5B7jtNdLUNWdFRDv6ciaUHWAtfIw4LUQFN0hZucRFbTu61KewtzMXyEek0VPg7nZZRrxI1YNODkwvysBVVbj/VQmTfnBvhBUF3896ZDRqDKh0iCJwA4AlSgbBtBofl4jMu4Yepw9vqHdPYyLJBTFUEYBjPQjE36wQfqYItGLUMfVko9SLjVEUYIW9opUFSSP0LBnH0DnMzOZDwPcSgrLqiqFATBeDsd0EJZTSPdTGLmJbMTdbx3tVC0tndcmbeZJIs7LoCNm9GXtOJqbxwTZ5cOBqOqbk+3AT1/2yiFqqSQxXMzoYNrJCA7UNlwn4VdOu3N5/jx280MT/sQ8uTt8XeffDpfCuFvDYduU6iUk8wl8thv98zCx3WQd2XDPjx9XTxTB3G3aQW9S1YzRXFlOfYmKfCYm90u+OFa2GRC3Bflyn2nbrFa1bJ8v1Zl2xZO4gzcbR+p/2ZkLg0lXWkP7wNhtBy2TW4Xre/WPYgIOA1jDYTrqmNKNHjDiYmV54T41AAxn7zvL1E34d2EGa6ybo98MiMkEt6mSkqBXkhQ3GzCqO979ua2TbetYvOd9upa/jF8E/cvtvRgrqvrMC2oMR0quWOyCE75ToG689RUnpNsflvowxUpurhZEtUuMFguC7LLvN0GYOO+BojA+HJYQddDlp0LGP45ZQUe1gUlgwm+Gooq9MwX8PfxHRsQbMplyRBsYYpsMacgvtDT9ddZmB1/XZtdXKapsMY/BMGKr7Zov+XJlAh4xBSISv+w0UwgRw31LqyAR/VKA7dkXr47XNM+/EYxrcAIrVIq4LToTXrCtb6cYiUVN24ycuw4WRy2IbC1rhdk2pDI1gbuMm3da+XquRSnIqHOrr9Fk3j7bO6hQmGGHVlyxuJn19R8ppiUk1BUGBd96kqb1YcCkxPpzRjYMqX9AijoGT6j42p7TOPi55a4x3EKLiplWglI9/lZc4XNN6i9x7fRFbQyAADg3DsRkdkGt7htW3mX3eDbaUpk7gzKwHuKJZ/dx2C94/J8QFHVXEdnTcyNZhrzO1wij5u1TEmwfLxwh7njcAjRt+QmSurCLByu6SX0ZJQUtR2ttpPxEnIJlLoG8yJqpdARFksPcue5xY+bDr9mOGaRwmf/BiCVXGa1nvvcPNTV4EJfdSS3Lo0qXSV+vyZWJTF1qbnZQD8AeGsnICf22CGELR/nK2tjhGX12vGcANWlvwUipeQtt+AmotP+xGHXkhBPnfUnaT+s5ZdkgPztlfXkvCfWf4FEliCy7tQqJCMlE99xo+kJUiJrpjaI/DcLc2Kl6CK/jfDtB9Ua+zcD1Hcy7GjRvOMDEFXKSoV1wSavYS0HPBNahfqiTHsdNH4Bn1KZUxgbdA75+PcAxR5UQYrmEVqBJlvHxWvvsqRJF9oSFw7Gt8WNkN9vtLJuVDLnHvBr9QGE7N/09vX4xWi3YRmYsvhCYqedlYQzG4XKzo57xS0vWun+1qli0k/8fUgixs77oA8f8QZLLaxH6x4llKVAb8UgduHuEGZgpH1wQeXP7tECqkKVIUqusEiz8hIwzDFMn9zebXp8+P4RLMqE2dTwrK0vIdE13N+vmO4q8xnBabOGM3SDz/gP6LMl4J05zmFeJIx9DIXE886B5DoNrG+rg6bOdKzI0dRUZHyMbzG7Ed3VF4OjmdWDJPg5UajLS4CVnm2IuNw8u5YtxSjRq68buzK88v12ApKX2zKDAunHZV8zQFMqV6fBGfzT1/iL+VDf3okHJEpTfG1U6JPsGa2C8P/V6KTVqdN6nZNMttTDOFeO97un44MC7lrNqAGTexEcjNPQoB6I4FuoRt2hk99ZGpndfMNelsIxhoIbKfQkTtCd3SFV7BSqOON+XMdwXh82+k+BG0RYLYhBn4/6e63mywSsAug+Nt+/ERakni8SllV3XLMrXkoVKT/0Rly6b4W8+g2+izerjwLSbVM1ea7wtoskRB3zJnyC+ZdRb1ULyZuXLlfxOUg3NIJjRJigW62Jo4oX6rf8/BvLhCn3fhdFwBbqISNvSuI29oCHWlWktXC8t7YC0ulAunGCUT1t2rCQTHkRkOGOSSQ04Zj6mu+AttOz5wuK7kTHoCb5+da5H6IGkIPgvR1+IAs9V8zXK3VQ5vVZO6GcXvz06nDSDZuBB6UQn5I9X8tjRy0g5bWFMniCC8cbS2K+OTpUVuDEJk1Lbyd1h67Kaa6NaxzmFjAN220gdRU8HG5qzCMH1j1MxWyKRvT5kP7HpV0NsjOfLpBi2WfAMS1dRZizqwdM6xNA2zfMCpy+57oo45t2Z1r3jRPgKEfhkkr0QyN8ClpzddyCeJnebIT/MePjxwT9B0AQKd0vu5zTMOAZekmoO8kJ4dHDETz/pnF98xTxzoUXAwt+pkE2J/JFQPAtRtFu0kYq7366ETJrHk47PFwan3mYKXj4m+EC0ssqoCPgmX6gEE8GyFw0tfVsqOAkbckTR6NtqZw4lTkB9PeUndFHliFpGBNtFAQ2lHJg2QG3nNUaHzVV+r3ek1faXSeBa2Sbr4wyOWQcJot++yB3Nu1lqfV8rYVSTMm5zerCdAF5CpKhZUTQqc1RtIusvE/HSFdcrKnMYtI05C7JpQYwaUOC1SxO+zPmDC44FGKm3oQ6BrPJOnYQghOVMP9AiuwZehzsuULGqSqnFL830cRh+BVY7+asybdMyMjaqbEufVVQe62DFxpPge+LLYT3S/7braD+3nQUuvHr8FglWwit6iFG2Zfu46dP19oMY0RZF+NFL9F3AthZO9smONldBfFb8FgvwulzJCGMCxlhDbae2XmDGigKowgAge+Ht5naotIewfO+f6C7MQh8MoZtDupaJqCP/my2rQ9b5HAvICweOcchr91vPXPTnu4NgyIMxrUE/JdZuM9Uh/ruTcI7dkwq5/+SOlGzEfT0pw3iQ+C3RxwaMisDbSQvzd3UJd0ORMSPwcYjbClStsKCO4QlOGxuCbW7YOMK8XMG866idcN69K6csPsdnqxbsoY3N0c9w4492X+o6t79wl6wpi5gLG1eP1F7dvmHvashEvtfCWdmdx9tSM5yjBGWBk10SIoAKH5bk3UQ4B3GNENrTPzoZY6d0NmolFXc1rlamFmKKs+Snjrr9Yl0GbGKSxcP4pQFAan342o/31b0Jv/mDa6GbbeBoYlc1yEVSNNcGCCG38oWY14Ns8YLRVrFsCjsYskmRawnNXMbEZT1J8aD2Afg4SqqWm309cnane/rOika2eB6vyWZQPUnOhQ5SDn+1YAtjWqRBSfICQPD5/YTI88DwATpDtd9eJ8oSBKZT6Mo4Hp76XjZEjktfZqUIyFAqFdrCfrrk1XAp2KNRonguublBpBL5aNtI2Qe19nv+ApOdiNdU+ueLJm763Ql8iuQiUnochxhJPIbxdktgfCrZXEAdwbqLz5UG41kIxbAXz2MJ3BsYnqzJ5UIln6Crt8rYUtfIZoT80NCSg0EBxg/hTX6Vaz1eqjMmCQ805LGL+Km4zLP9xhYEjetvlbLtt+Vm/JRhsek63+QKTqX86E+QfBj6WGxd1DE8qp+adBS8oBhhDP0af7cG5l+VNw/skdM6xcWJ/GqooUG+VPxrnnCmMkSdxLh4bMxj4yDHqhe45hlWW+RgyX6zyIb+fyc3/8TQTlFOoQFig6XmEj7zpXe5xfOUqdaEre0tzCq+t6V9F9Rk3AXDFJSs7a4fUuPJarCs6x2Tr0mGHVw+2N4AKBM5OS0XlTjvAo49JaglmYx/+DVYMKBPnc+ft/X+8GLa0YBJgKQTCLmRe6mDSLABPiNGvIyuQvK2jz6CBNSqmK3UzZW9b6fDXtDnXwjsUaMpL5LLtsX+0htUb0tgMRb320NY7gkbjkroxMRCFw/iPF9VxtIT4airsjPc1vd9zheedCAMDL2+JQpKPSvXNtPHOWCemAA167H6IPEup2CFAl8Z4biHswM5u8SeulNGh+qTw5OE7/jOgvFfLrPktgzw6sBROvvRl8UHkVt+v+A9tOE6PJXj1Eh22tHfYOxQGB0NnKXtN2kRGjAJbMaGCOiF+6JjdjWWQXFk4tCGZjCanuV1rmFOJoiy/mJydg5xQTQoQrN87k7gqh6TCPzFLqleyblMVzMH9JYIjrfnx3ORdrk/FICvrLUmp4GBE9dxL0EAZsff6WEFVrPqvxFbRkcRnuj19z/zlRI0nHTmLdqwY2D9NbGETHCdAQgqh4FIK6vaYP4icqM=", "encrypted text");
|
||||
decryptedText = Clipperz.PM.Crypto.encryptingFunctions.versions[ClipperzCryptoVersion].decrypt(key, encryptedText);
|
||||
is(decryptedText, plainText, "encrypt <-> decrypt works (specifying the nonce)");
|
||||
|
||||
startTime = new Date();
|
||||
encryptedText = Clipperz.PM.Crypto.encryptingFunctions.versions[ClipperzCryptoVersion].encrypt(key, plainText);
|
||||
endTime = new Date();
|
||||
//console.log("[2] encryption time: " + (endTime - startTime));
|
||||
is((endTime - startTime < 350), true, "[2] Need to improve some more (" + (endTime - startTime) + ")");
|
||||
decryptedText = Clipperz.PM.Crypto.encryptingFunctions.versions[ClipperzCryptoVersion].decrypt(key, encryptedText);
|
||||
is(decryptedText, plainText, "encrypt <-> decrypt works");
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//
|
||||
// veryLongText encryption performance
|
||||
//
|
||||
//--------------------------------------------------------------
|
||||
/*
|
||||
plainText = veryLongText;
|
||||
|
||||
startTime = new Date();
|
||||
encryptedText = Clipperz.PM.Crypto.encryptingFunctions.versions[ClipperzCryptoVersion].encrypt(key, plainText);
|
||||
endTime = new Date();
|
||||
//console.log("[3] encryption time: " + (endTime - startTime));
|
||||
is((endTime - startTime < 35000), true, "[3] Need to improve some more (" + (endTime - startTime) + ")");
|
||||
decryptedText = Clipperz.PM.Crypto.encryptingFunctions.versions[ClipperzCryptoVersion].decrypt(key, encryptedText);
|
||||
is(decryptedText, plainText, "encrypt <-> decrypt works");
|
||||
*/
|
||||
|
||||
//#############################################################################
|
||||
|
||||
} catch (err) {
|
||||
|
||||
var s = "test suite failure!\n";
|
||||
var o = {};
|
||||
var k = null;
|
||||
for (k in err) {
|
||||
// ensure unique keys?!
|
||||
if (!o[k]) {
|
||||
s += k + ": " + err[k] + "\n";
|
||||
o[k] = err[k];
|
||||
}
|
||||
}
|
||||
ok ( false, s );
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
169
frontend/gamma/tests/tests/Clipperz/PM/Crypto_test.html
Normal file
169
frontend/gamma/tests/tests/Clipperz/PM/Crypto_test.html
Normal file
@@ -0,0 +1,169 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.Crypto - TEST</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/JSON/json2.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/DOM.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
|
||||
<!-- ================================================================================ --> <script>
|
||||
//MochiKit.DOM.addLoadEvent(MochiKit.Base.partial(MochiKit.LoggingPane.createLoggingPane, true));
|
||||
//MochiKit.Logging.logger.useNativeConsole = true;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
encodePassword = function (anEvent) {
|
||||
var username;
|
||||
var password;
|
||||
var encodedPassword;
|
||||
var srpConnection;
|
||||
|
||||
anEvent.stop();
|
||||
|
||||
srpConnection = new Clipperz.PM.Connection.SRP['1.1']();
|
||||
|
||||
username = MochiKit.DOM.getElement('username').value;
|
||||
passphrase = MochiKit.DOM.getElement('passphrase').value;
|
||||
encodedPassword = srpConnection.normalizedCredentials({'username':username , 'password':passphrase })['password'];
|
||||
|
||||
MochiKit.DOM.getElement('encodedPassword').value = encodedPassword;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
decryptData = function (anEvent) {
|
||||
var deferredResult;
|
||||
var key;
|
||||
var version;
|
||||
var value;
|
||||
|
||||
key = MochiKit.DOM.getElement('key').value;
|
||||
version = MochiKit.DOM.getElement('version').value;
|
||||
value = MochiKit.DOM.getElement('encryptedText').value;
|
||||
|
||||
anEvent.stop();
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("Decrypted data", {trace:false});
|
||||
deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, {key:key, version:version, value:value});
|
||||
deferredResult.addCallback(Clipperz.Base.serializeJSON);
|
||||
deferredResult.addCallback(function (aValue) {
|
||||
MochiKit.DOM.getElement('decryptedText').value = aValue;
|
||||
});
|
||||
deferredResult.addErrback(alert);
|
||||
|
||||
deferredResult.callback();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
encryptData = function (anEvent) {
|
||||
var deferredResult;
|
||||
var key;
|
||||
var version;
|
||||
var value;
|
||||
|
||||
key = MochiKit.DOM.getElement('key').value;
|
||||
version = MochiKit.DOM.getElement('version').value;
|
||||
value = Clipperz.Base.evalJSON(MochiKit.DOM.getElement('decryptedText').value);
|
||||
|
||||
anEvent.stop();
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("Encrypted data", {trace:false});
|
||||
deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncrypt, {key:key, version:version, value:value});
|
||||
deferredResult.addCallback(function (aValue) {
|
||||
MochiKit.DOM.getElement('encryptedText').value = aValue;
|
||||
});
|
||||
deferredResult.addErrback(alert);
|
||||
|
||||
deferredResult.callback();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
init = function () {
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
|
||||
MochiKit.Signal.connect('decryptForm', 'onsubmit', decryptData)
|
||||
MochiKit.Signal.connect('decryptButton', 'onclick', decryptData)
|
||||
MochiKit.Signal.connect('encryptButton', 'onclick', encryptData)
|
||||
|
||||
// MochiKit.Signal.connect('encodePassword', 'onclick', encodePassword)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
MochiKit.DOM.addLoadEvent(init);
|
||||
|
||||
</script> <!-- =============================================================================== -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
<form id='computeKey'>
|
||||
<input type='text' name='username' value='' id='username' size='30'/>
|
||||
<input type='text' name='passphrase' value='' id='passphrase' size='30'/>
|
||||
<input type='button' name='encode' value='encode' id='encodePassword'>
|
||||
<input type='text' name='encodedPassword' value='' id='encodedPassword' size='30'/>
|
||||
</form>
|
||||
<hr>
|
||||
-->
|
||||
<form id='decryptForm'>
|
||||
<div><textarea id='encryptedText' cols='80' rows='20'></textarea></div>
|
||||
<div><input type='text' name='key' value='' id='key' size='30'/></div>
|
||||
<div><input type='text' name='version' value='0.3' id='version' /></div>
|
||||
<div><input type='button' name='decrypt' value='decrypt' id='decryptButton'> <input type='button' name='encrypt' value='encrypt' id='encryptButton'></div>
|
||||
<hr>
|
||||
<div><textarea id='decryptedText' cols='80' rows='20' style="background-color: lightgrey;"><result></textarea></div>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.DirectLogin - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/JSON/json2.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Test.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.Field.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginInput.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginBinding.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Preferences.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/OneTimePassword.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
<script>
|
||||
Clipperz_IEisBroken = false;
|
||||
</script>
|
||||
|
||||
<!--[if IE]><script>
|
||||
Clipperz_IEisBroken = true;
|
||||
Clipperz_normalizedNewLine = '\x0d\x0a';
|
||||
</script><![endif]-->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
Clipperz.PM.Strings.Languages.setSelectedLanguage('en-us');
|
||||
</script>
|
||||
<script type="text/javascript" src="User.data.js"></script>
|
||||
<script type="text/javascript" src="User.data.old.js"></script>
|
||||
<script type="text/javascript" src="DirectLogin.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
/*
|
||||
user = new Clipperz.PM.DataModel.User({username:'test', getPassphraseFunction:function () { return 'test';}});
|
||||
...
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'getRecord', '8280842f41162b673335b63860637e8472e8bbff0efa2bc78b0dbc5e09712e13');
|
||||
|
||||
|
||||
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
|
||||
...
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'getRecord', '5cdac63b317f3942da38f3a3de3b7f0e5d6678200951c6216230295550f63fb4'); // WEB PASSWORD (0)
|
||||
deferredResult.addMethod(user, 'getRecord', '36ec1a41118813ced3553534fa2607d781cba687768db305beed368a8e06e113'); // DIGG (1)
|
||||
deferredResult.addMethod(user, 'getRecord', 'c0ce9130ca365bb02418d4305ea1d29e49c3f0e96d44b9d3cb6b4b6843d25065'); // SAP (2)
|
||||
deferredResult.addMethod(user, 'getRecord', 'd5f700b9c3367c39551ea49e00a9ab20dae09dd79d46047b983fc7c4bfaa050d'); // YAHOO (4)
|
||||
DirectLogin references
|
||||
- dba0db679802f0e6aa6d0b7a6aaf42350aabc5f057409edd99a268a92ebb6496 // Yahoo! Mail
|
||||
- aa18149164302d5dbe7e2d3724565b9550e00887b49978559783b2e38c625584 // (Yahoo! Groups)
|
||||
- 6f7bbc4e42ea462b5246e6f51c3f86056bec50601ce2de6067c8c1d26f21c07f // (Flickr)
|
||||
- a7b32e72502804bf2946a2a8856139cbbb759c5777e6b3e673db1fdf7e3bd06e // (My Yahoo!)
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'editDirectLoginLabel_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("editDirectLoginLabel_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecord', 'd5f700b9c3367c39551ea49e00a9ab20dae09dd79d46047b983fc7c4bfaa050d'); // YAHOO (4)
|
||||
deferredResult.addMethodcaller('directLogins');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('dba0db679802f0e6aa6d0b7a6aaf42350aabc5f057409edd99a268a92ebb6496'));
|
||||
deferredResult.addCallback(function (aDirectLogin) {
|
||||
var innerDeferredResult;
|
||||
var updatedLabel;
|
||||
|
||||
updatedLabel = "updated Yahoo! Mail label";
|
||||
|
||||
innerDeferredResult = new Clipperz.Async.Deferred("editDirectLoginLabel_test <inner>", someTestArgs);
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest("Yahoo! Mail", "The label of the selected direct login is correct.");
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'setLabel', updatedLabel);
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest(updatedLabel, "The DirectLogin returns the correct label even before committing data.");
|
||||
|
||||
innerDeferredResult.addMethod(user, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(true, "When changing the label of a DirectLogin, the user should report pending changes.");
|
||||
|
||||
//innerDeferredResult.addCallback(function () { console.log("+_+_+_+_+_+_+_+_+_+_+_+ >>>")});
|
||||
innerDeferredResult.addMethod(user, 'saveChanges');
|
||||
//innerDeferredResult.addCallback(function () { console.log("+_+_+_+_+_+_+_+_+_+_+_+ <<<")});
|
||||
innerDeferredResult.addMethod(user, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(false, "After saving changes there should be no pending changes left.");
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest(updatedLabel, "The DirectLogin returns the correct label even after committing data.");
|
||||
|
||||
innerDeferredResult.callback();
|
||||
|
||||
return innerDeferredResult;
|
||||
})
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'editDirectLoginLabel_thanResetItToThePreviousValue_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("editDirectLoginLabel_thanResetItToThePreviousValue_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecord', 'd5f700b9c3367c39551ea49e00a9ab20dae09dd79d46047b983fc7c4bfaa050d'); // YAHOO (4)
|
||||
deferredResult.addMethodcaller('directLogins');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('dba0db679802f0e6aa6d0b7a6aaf42350aabc5f057409edd99a268a92ebb6496'));
|
||||
deferredResult.addCallback(function (aDirectLogin) {
|
||||
var innerDeferredResult;
|
||||
var originalLabel;
|
||||
var updatedLabel;
|
||||
|
||||
originalLabel = "Yahoo! Mail";
|
||||
updatedLabel = "updated Yahoo! Mail label";
|
||||
|
||||
innerDeferredResult = new Clipperz.Async.Deferred("editDirectLoginLabel_thanResetItToThePreviousValue_test <inner>", someTestArgs);
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest(originalLabel, "The label of the selected direct login is correct.");
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'setLabel', updatedLabel);
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest(updatedLabel, "The DirectLogin returns the correct label even before committing data.");
|
||||
|
||||
innerDeferredResult.addMethod(user, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(true, "When changing the label of a DirectLogin, the user should report pending changes [2].");
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'setLabel', originalLabel);
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(false, "Restoring the original label, the directLogin should report no pending changes.");
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin.record(), 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(false, "Restoring the original label, the record should report no pending changes.");
|
||||
|
||||
innerDeferredResult.addMethod(user, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(false, "Restoring the original label, the user should report no pending changes.");
|
||||
|
||||
innerDeferredResult.callback();
|
||||
|
||||
return innerDeferredResult;
|
||||
})
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
'bindingValues_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("DirectLogin.bindingValues_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecord', 'd5f700b9c3367c39551ea49e00a9ab20dae09dd79d46047b983fc7c4bfaa050d'); // YAHOO (4)
|
||||
deferredResult.addMethodcaller('directLogins');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('dba0db679802f0e6aa6d0b7a6aaf42350aabc5f057409edd99a268a92ebb6496'));
|
||||
deferredResult.addMethodcaller('bindingValues');
|
||||
deferredResult.addCallback(function (someBindingValues) {
|
||||
SimpleTest.is(MochiKit.Base.keys(someBindingValues).length, 2, "there should be 2 bindings for this direct login");
|
||||
SimpleTest.is(someBindingValues['login'], 'joe.clipperz', "the login field should be filled with 'joe.clipperz'");
|
||||
SimpleTest.is(someBindingValues['passwd'], 'enfvDG1RxAsl', "the passwd field should be filled with 'enfvDG1RxAsl'");
|
||||
})
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
//#############################################################################
|
||||
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.DataModel.DirectLogin", tests, {trace:false});
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
directLoginConfigurations = {
|
||||
'Yahoo! Mail': '{\n "page": {\n "title": "Yahoo! Mail"\n },\n "form": {\n "attributes": {\n "action": "https://login.yahoo.com/config/login?",\n "method": "post"\n },\n "inputs": [\n {\n "type": "hidden",\n "name": ".tries",\n "value": "1"\n },\n {\n "type": "hidden",\n "name": ".src",\n "value": "ym"\n },\n {\n "type": "hidden",\n "name": ".md5",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".hash",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".js",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".last",\n "value": ""\n },\n {\n "type": "hidden",\n "name": "promo",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".intl",\n "value": "us"\n },\n {\n "type": "hidden",\n "name": ".bypass",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".partner",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".u",\n "value": "5gp62cl2vg3ov"\n },\n {\n "type": "hidden",\n "name": ".v",\n "value": "0"\n },\n {\n "type": "hidden",\n "name": ".challenge",\n "value": "iBEY0IK6k3t9Uals32mrTos8s48p"\n },\n {\n "type": "hidden",\n "name": ".yplus",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".emailCode",\n "value": ""\n },\n {\n "type": "hidden",\n "name": "pkg",\n "value": ""\n },\n {\n "type": "hidden",\n "name": "stepid",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".ev",\n "value": ""\n },\n {\n "type": "hidden",\n "name": "hasMsgr",\n "value": "0"\n },\n {\n "type": "hidden",\n "name": ".chkP",\n "value": "Y"\n },\n {\n "type": "hidden",\n "name": ".done",\n "value": "http://mail.yahoo.com"\n },\n {\n "type": "hidden",\n "name": ".pd",\n "value": "ym_ver%3d0%26c="\n },\n {\n "type": "text",\n "name": "login",\n "value": ""\n },\n {\n "type": "password",\n "name": "passwd",\n "value": ""\n },\n {\n "type": "checkbox",\n "name": ".persistent",\n "value": "y"\n },\n {\n "type": "submit",\n "name": ".save",\n "value": "Sign In"\n }\n ]\n },\n "version": "0.2"\n}',
|
||||
'Parallels': '{"page": {"title": "Parallels Account"},\n"form": {"attributes": {"action": "https://www.parallels.com/account/",\n"method": "post"},\n"inputs": [{"type": "text",\n"name": "Email",\n"value": ""},\n{"type": "password",\n"name": "Password",\n"value": ""}]},\n"version": "0.2.3"}',
|
||||
__syntaxFix__: "syntax fix"
|
||||
};
|
||||
@@ -0,0 +1,66 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.EncryptedRemoteObject - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/JSON/json2.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="EncryptedRemoteObject.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'simple_tests': function(someTestArgs) {
|
||||
var deferredResult;
|
||||
var encryptedRemoteObject;
|
||||
|
||||
var key;
|
||||
var version;
|
||||
var rawData;
|
||||
|
||||
key = "just a random key";
|
||||
version = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
|
||||
rawData = "just a random text to encrypt";
|
||||
|
||||
encryptedRemoteObject = new Clipperz.PM.DataModel.EncryptedRemoteObject({
|
||||
'retrieveKeyFunction': MochiKit.Base.noop,
|
||||
'retrieveRemoteDataFunction': function () { return "--"},
|
||||
'encryptedDataKeypath': '--',
|
||||
'encryptedVersionKeypath': '--'
|
||||
});
|
||||
SimpleTest.ok(encryptedRemoteObject != null, "create an encryptedRemoteObject");
|
||||
|
||||
deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.test - simple_tests", [
|
||||
MochiKit.Base.method(encryptedRemoteObject, 'getRemoteData'),
|
||||
function(aResult) {
|
||||
SimpleTest.is(aResult, "--", "setting and getting serverData works");
|
||||
}
|
||||
], someTestArgs);
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'decrypt_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var encryptedRemoteObject;
|
||||
var key;
|
||||
var version;
|
||||
var rawData;
|
||||
|
||||
key = "just a random key";
|
||||
version = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
|
||||
rawData = "just a random text to encrypt";
|
||||
|
||||
encryptedRemoteObject = new Clipperz.PM.DataModel.EncryptedRemoteObject({
|
||||
'retrieveKeyFunction': MochiKit.Base.partial(MochiKit.Async.succeed, key),
|
||||
'retrieveRemoteDataFunction': MochiKit.Base.partial(Clipperz.Async.callbacks, "EncryptedRemoteObject.test - decrypt_test <encrypt data>", [
|
||||
MochiKit.Base.partial(Clipperz.PM.Crypto.deferredEncrypt, {key:key, value:rawData, version:version}),
|
||||
function (someEncryptedData) {
|
||||
return {
|
||||
'data': someEncryptedData,
|
||||
'version': version
|
||||
}
|
||||
}
|
||||
], someTestArgs)//,
|
||||
// 'encryptedDataKeypath': 'data',
|
||||
// 'encryptedVersionKeypath': 'version'
|
||||
});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("decrypt_test", someTestArgs);
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getDecryptedData');
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.is(aResult, rawData, "encrypt and decrypt works");
|
||||
})
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'getValue_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var encryptedRemoteObject;
|
||||
var key;
|
||||
var version;
|
||||
var rawData;
|
||||
|
||||
key = "just a random key";
|
||||
version = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
|
||||
rawData = {
|
||||
key1: 'value1',
|
||||
key2: 'value2'
|
||||
};
|
||||
|
||||
encryptedRemoteObject = new Clipperz.PM.DataModel.EncryptedRemoteObject({
|
||||
'reference': "testReference",
|
||||
'retrieveKeyFunction': MochiKit.Base.partial(MochiKit.Async.succeed, key),
|
||||
'retrieveRemoteDataFunction': MochiKit.Base.partial(Clipperz.Async.callbacks, "EncryptedRemoteObject.test - decrypt_test <encrypt data>", [
|
||||
MochiKit.Base.partial(Clipperz.PM.Crypto.deferredEncrypt, {key:key, value:rawData, version:version}),
|
||||
function (someEncryptedData) {
|
||||
return {
|
||||
'data': someEncryptedData,
|
||||
'version': version
|
||||
}
|
||||
}
|
||||
], someTestArgs)//,
|
||||
// 'encryptedDataKeypath': 'data',
|
||||
// 'encryptedVersionKeypath': 'version'
|
||||
});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("decrypt_test", someTestArgs);
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getValue', 'key1');
|
||||
deferredResult.addTest('value1', "getting 'key1' works");
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasAnyCleanTextData');
|
||||
deferredResult.addTest(true, "After accessing a value, hasAnyCleanTextData returns false");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasPendingChanges');
|
||||
deferredResult.addTest(false, "if nothing has changed, the object should return not pending changes");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'deleteAllCleanTextData');
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasAnyCleanTextData');
|
||||
deferredResult.addTest(false, "After deleting all cleanTextData, hasAnyCleanTextData returns false");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getValue', 'key1');
|
||||
deferredResult.addTest('value1', "getting 'key1' (also after a lock) works correctly");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'setValue', 'key1', 'new value1');
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getValue', 'key1');
|
||||
deferredResult.addTest('new value1', "after setting a new value, it is correctly returned");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'values');
|
||||
deferredResult.addCallback(function (someValues) {
|
||||
SimpleTest.is(someValues['key1'], 'new value1', "the value got straight from the objectStore is correct");
|
||||
});
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasPendingChanges');
|
||||
deferredResult.addTest(true, "once a value has been changed, the object should return that there're some pending changes");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'revertChanges');
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasPendingChanges');
|
||||
deferredResult.addTest(false, "reverting the changes should return the object to its initial state, without any peding changes");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getValue', 'key1');
|
||||
deferredResult.addTest('value1', "also the value of the changed item has been restored");
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'encrypt_with_new_object_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var encryptedRemoteObject;
|
||||
var key;
|
||||
// var version;
|
||||
// var rawData;
|
||||
|
||||
key = "just a random key";
|
||||
// version = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
|
||||
// rawData = "just a random text to encrypt";
|
||||
|
||||
encryptedRemoteObject = new Clipperz.PM.DataModel.EncryptedRemoteObject({
|
||||
'retrieveRemoteDataFunction': MochiKit.Base.noop
|
||||
});
|
||||
|
||||
encryptedRemoteObject.setValue('key1', "value1");
|
||||
encryptedRemoteObject.setValue('key2', "value2");
|
||||
encryptedRemoteObject.setValue('key3', "value3");
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("encrypt_with_new_object_test", someTestArgs);
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'prepareRemoteDataWithKey', key);
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('data'));
|
||||
deferredResult.collectResults({
|
||||
'key': MochiKit.Base.partial(MochiKit.Async.succeed, key),
|
||||
'value': MochiKit.Async.succeed,
|
||||
'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Crypto.encryptingFunctions.currentVersion)
|
||||
});
|
||||
deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt);
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.is(aResult['key1'], "value1", "encrypt and decrypt works for first element");
|
||||
SimpleTest.is(aResult['key2'], "value2", "encrypt and decrypt works for second element");
|
||||
SimpleTest.is(aResult['key3'], "value3", "encrypt and decrypt works for third element");
|
||||
})
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
//#############################################################################
|
||||
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.DataModel.EncryptedRemoteObject", tests, {trace:false});
|
||||
@@ -0,0 +1,105 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.User - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/JSON/json2.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Test.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.Field.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginInput.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginBinding.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginFormValue.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Preferences.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/OneTimePassword.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
<script>
|
||||
Clipperz_IEisBroken = false;
|
||||
</script>
|
||||
|
||||
<!--[if IE]><script>
|
||||
Clipperz_IEisBroken = true;
|
||||
Clipperz_normalizedNewLine = '\x0d\x0a';
|
||||
</script><![endif]-->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
Clipperz.PM.Strings.Languages.setSelectedLanguage('en-us');
|
||||
</script>
|
||||
<script type="text/javascript" src="User.data.js"></script>
|
||||
<script type="text/javascript" src="OneTimePassword.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'isValidOneTimePasswordValue_test': function (someTestArgs) {
|
||||
var otp;
|
||||
var notOTP;
|
||||
|
||||
otp = 'yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg';
|
||||
SimpleTest.is(Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue(otp), true, "isValidOneTimePasswordValue [expect true] - test 1");
|
||||
|
||||
notOTP = 'trustno1';
|
||||
SimpleTest.is(Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue(notOTP), false, "isValidOneTimePasswordValue [expect false] - test 1");
|
||||
|
||||
return MochiKit.Async.succeed('done');
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'loginUsingOtp_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user, user2;
|
||||
var username;
|
||||
var passphrase;
|
||||
|
||||
username = "test";
|
||||
passphrase = "yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"; // OTP
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:username, getPassphraseFunction:function () { return passphrase;}});
|
||||
user2 = new Clipperz.PM.DataModel.User({username:username, getPassphraseFunction:function () { return passphrase;}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("loginUsingOtp_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_with_otps']);
|
||||
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has one single card");
|
||||
|
||||
deferredResult.addMethod(user, 'getOneTimePasswords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has one OTP");
|
||||
|
||||
deferredResult.addMethod(user, 'getOneTimePasswords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter(0));
|
||||
deferredResult.addCallback(MochiKit.Base.methodcaller('status'));
|
||||
deferredResult.addTest('USED', "The available OTP has been unsed to login, and should be marked accordingly");
|
||||
|
||||
deferredResult.addMethod(user2, 'login');
|
||||
deferredResult.shouldFail("trying to login using the same OTP twice");
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'changePassphraseAndLoginUsingOtp_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
var user2;
|
||||
var user3;
|
||||
var otp;
|
||||
|
||||
otp = "yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"; // OTP
|
||||
|
||||
newPassphrase = 'tset';
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:'test', getPassphraseFunction:function () { return 'test';}});
|
||||
user2 = new Clipperz.PM.DataModel.User({username:'test', getPassphraseFunction:function () { return otp;}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("changePassphraseAndLoginUsingOtp_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_with_otps']);
|
||||
|
||||
deferredResult.addMethod(user, 'login');
|
||||
|
||||
deferredResult.addMethod(user, 'getRecords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has only a single card");
|
||||
|
||||
deferredResult.addMethod(user, 'changePassphrase', newPassphrase);
|
||||
deferredResult.addMethod(user, 'logout');
|
||||
|
||||
deferredResult.addMethod(user2, 'login');
|
||||
deferredResult.addMethod(user2, 'getRecords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has oly a single card");
|
||||
deferredResult.addMethod(user2, 'logout');
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'loginUsingOtpAndWrongUsername_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user, user2;
|
||||
var username;
|
||||
var wrongUsername;
|
||||
var passphrase;
|
||||
|
||||
username = "test";
|
||||
wrongUsername = "tset";
|
||||
passphrase = "yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"; // OTP
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:wrongUsername, getPassphraseFunction:function () { return passphrase;}});
|
||||
user2 = new Clipperz.PM.DataModel.User({username:username, getPassphraseFunction:function () { return passphrase;}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("loginUsingOtpAndWrongUsername_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_with_otps']);
|
||||
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.shouldFail("login in using the wrong username with the OTP should fail");
|
||||
|
||||
deferredResult.addMethod(user2, 'login');
|
||||
deferredResult.shouldFail("trying to reuse the same OTP should fail, even if now it is used with the correct username");
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'loginUserWithAPassphraseLookingExactlyLikeAnOTP_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
var username;
|
||||
var passphrase;
|
||||
|
||||
username = "otp_user";
|
||||
passphrase = "yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"; // passphrase
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:username, getPassphraseFunction:function () { return passphrase;}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("loginUserWithAPassphraseLookingExactlyLikeAnOTP_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['otp_user_test']);
|
||||
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has one single card");
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
|
||||
|
||||
//#############################################################################
|
||||
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.DataModel.OneTimePassword", tests, {trace:false});
|
||||
98
frontend/gamma/tests/tests/Clipperz/PM/DataModel/Record.html
Normal file
98
frontend/gamma/tests/tests/Clipperz/PM/DataModel/Record.html
Normal file
@@ -0,0 +1,98 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.Record - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/JSON/json2.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Test.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.Field.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginInput.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginBinding.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginFormValue.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Preferences.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/OneTimePassword.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
Clipperz.PM.Strings.Languages.setSelectedLanguage('en-us');
|
||||
</script>
|
||||
<script type="text/javascript" src="DirectLoginConfigurations.data.js"></script>
|
||||
<script type="text/javascript" src="User.data.js"></script>
|
||||
<script type="text/javascript" src="Record.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
1285
frontend/gamma/tests/tests/Clipperz/PM/DataModel/Record.test.js
Normal file
1285
frontend/gamma/tests/tests/Clipperz/PM/DataModel/Record.test.js
Normal file
File diff suppressed because it is too large
Load Diff
1941
frontend/gamma/tests/tests/Clipperz/PM/DataModel/User.data.js
Normal file
1941
frontend/gamma/tests/tests/Clipperz/PM/DataModel/User.data.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
106
frontend/gamma/tests/tests/Clipperz/PM/DataModel/User.html
Normal file
106
frontend/gamma/tests/tests/Clipperz/PM/DataModel/User.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.User - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/JSON/json2.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Test.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.Field.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginInput.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginBinding.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginFormValue.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Preferences.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/OneTimePassword.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
<script>
|
||||
Clipperz_IEisBroken = false;
|
||||
</script>
|
||||
|
||||
<!--[if IE]><script>
|
||||
Clipperz_IEisBroken = true;
|
||||
Clipperz_normalizedNewLine = '\x0d\x0a';
|
||||
</script><![endif]-->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
Clipperz.PM.Strings.Languages.setSelectedLanguage('en-us');
|
||||
</script>
|
||||
<script type="text/javascript" src="User.data.js"></script>
|
||||
<script type="text/javascript" src="User.data.old.js"></script>
|
||||
<script type="text/javascript" src="User.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
2082
frontend/gamma/tests/tests/Clipperz/PM/DataModel/User.test.js
Normal file
2082
frontend/gamma/tests/tests/Clipperz/PM/DataModel/User.test.js
Normal file
File diff suppressed because it is too large
Load Diff
47
frontend/gamma/tests/tests/Clipperz/PM/DataModel/index.html
Normal file
47
frontend/gamma/tests/tests/Clipperz/PM/DataModel/index.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.* - tests</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/TestRunner.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
TestRunner.runTests(
|
||||
'EncryptedRemoteObject.html',
|
||||
'Record.html',
|
||||
'DirectLogin.html',
|
||||
'User.html',
|
||||
'OneTimePassword.html'
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
59
frontend/gamma/tests/tests/Clipperz/PM/Date.html
Normal file
59
frontend/gamma/tests/tests/Clipperz/PM/Date.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.Date - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<!-- script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script -->
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../js/JSON/json2.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="Date.test.js"></script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
90
frontend/gamma/tests/tests/Clipperz/PM/Date.test.js
Normal file
90
frontend/gamma/tests/tests/Clipperz/PM/Date.test.js
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
var tests = {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'offlineDataParsing_test': function () {
|
||||
var value;
|
||||
var parsedValue;
|
||||
var expectedValue;
|
||||
|
||||
value = 'Tue Mar 27 06:41:37 PDT 2007';
|
||||
parsedValue = Clipperz.PM.Date.parse(value);
|
||||
expectedValue = new Date();
|
||||
expectedValue.setUTCFullYear(2007, 03 - 1, 27);
|
||||
expectedValue.setUTCHours(13, 41, 37);
|
||||
// SimpleTest.is(parsedValue.toString(), 'Tue Mar 27 2007 15:41:37 GMT+0200 (CEST)', "the data in the format stored in the offline copy is processed correctly [1]");
|
||||
SimpleTest.is(parsedValue.toString(), expectedValue.toString(), "the data in the format stored in the offline copy is processed correctly [1]");
|
||||
|
||||
value = 'Thu May 10 15:01:21 PDT 2007';
|
||||
parsedValue = Clipperz.PM.Date.parse(value);
|
||||
expectedValue = new Date();
|
||||
expectedValue.setUTCFullYear(2007, 05 - 1, 10);
|
||||
expectedValue.setUTCHours(22, 01, 21);
|
||||
// SimpleTest.is(parsedValue.toString(), 'Fri May 11 2007 00:01:21 GMT+0200 (CEST)', "the data in the format stored in the offline copy is processed correctly [3]");
|
||||
SimpleTest.is(parsedValue.toString(), expectedValue.toString(), "the data in the format stored in the offline copy is processed correctly [3]");
|
||||
|
||||
value = 'Thu May 10 15:01:21 PST 2007';
|
||||
parsedValue = Clipperz.PM.Date.parse(value);
|
||||
expectedValue = new Date();
|
||||
expectedValue.setUTCFullYear(2007, 05 - 1, 10);
|
||||
expectedValue.setUTCHours(23, 01, 21);
|
||||
// SimpleTest.is(parsedValue.toString(), 'Fri May 11 2007 01:01:21 GMT+0200 (CEST)', "the data in the format stored in the offline copy is processed correctly [3]");
|
||||
SimpleTest.is(parsedValue.toString(), expectedValue.toString(), "the data in the format stored in the offline copy is processed correctly [3]");
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'onlineDataParsing_test': function () {
|
||||
var value;
|
||||
var parsedValue;
|
||||
var expectedValue;
|
||||
|
||||
value = 'Tue, 27 March 2007 06:41:37 PDT';
|
||||
parsedValue = Clipperz.PM.Date.parse(value);
|
||||
expectedValue = new Date();
|
||||
expectedValue.setUTCFullYear(2007, 03 - 1, 27);
|
||||
expectedValue.setUTCHours(13, 41, 37);
|
||||
|
||||
// SimpleTest.is(parsedValue.toString(), 'Tue Mar 27 2007 15:41:37 GMT+0200 (CEST)', "the data in the format returned by the server is processed correctly");
|
||||
SimpleTest.is(parsedValue.toString(), expectedValue.toString(), "the data in the format returned by the server is processed correctly");
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
//#############################################################################
|
||||
|
||||
Clipperz.PM.Strings.Languages.initSetup();
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.Date", tests, {trace:false});
|
||||
|
||||
|
||||
|
||||
65
frontend/gamma/tests/tests/Clipperz/PM/Proxy.html
Normal file
65
frontend/gamma/tests/tests/Clipperz/PM/Proxy.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.Proxy - TEST</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="Proxy.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
117
frontend/gamma/tests/tests/Clipperz/PM/Proxy.test.js
Normal file
117
frontend/gamma/tests/tests/Clipperz/PM/Proxy.test.js
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'simple_tests': function() {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("simple_tests", {trace:false});
|
||||
deferredResult.addCallback(function() {
|
||||
var proxy;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy();
|
||||
ok(proxy != null, "can create instances of the Proxy class");
|
||||
is(proxy.shouldPayTolls(), false, "proxy is set to NOT pay tolls by default");
|
||||
});
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'simpleTestsWithTolls_tests': function() {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("simple_tests", {trace:false});
|
||||
deferredResult.addCallback(function() {
|
||||
var proxy;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy({shouldPayTolls:true});
|
||||
is(proxy.shouldPayTolls(), true, "I can set Proxy to pays tolls");
|
||||
});
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
//#############################################################################
|
||||
|
||||
runTests = function(aClassName) {
|
||||
try {
|
||||
var deferredTests;
|
||||
var aTestName;
|
||||
|
||||
deferredTests = new Clipperz.Async.Deferred(aClassName + ".test", {trace:false});
|
||||
|
||||
aTestName = window.location.href.match(/#.*/);
|
||||
if (aTestName && (aTestName != '#')) {
|
||||
aTestName = aTestName[0].slice(1);
|
||||
if (aTestName in tests) {
|
||||
//Clipperz.log("single test execution, via fragment identifier", aTestName);
|
||||
deferredTests.addCallback(tests[aTestName]);
|
||||
deferredTests.addErrback(SimpleTest.ok, false, aTestName);
|
||||
} else {
|
||||
deferredTests.addBoth(is, aTestName, null, "Wrong test name selected to run");
|
||||
}
|
||||
} else {
|
||||
for (aTestName in tests) {
|
||||
deferredTests.addCallback(tests[aTestName]);
|
||||
deferredTests.addErrback(SimpleTest.ok, false, aTestName);
|
||||
}
|
||||
deferredTests.addBoth(is, true, true, "FINISH: completed the full stack of tests");
|
||||
}
|
||||
deferredTests.addBoth(SimpleTest.finish);
|
||||
deferredTests.callback();
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
} catch (err) {
|
||||
var s = "test suite failure!\n";
|
||||
var o = {};
|
||||
var k = null;
|
||||
for (k in err) {
|
||||
// ensure unique keys?!
|
||||
if (!o[k]) {
|
||||
s += k + ": " + err[k] + "\n";
|
||||
o[k] = err[k];
|
||||
}
|
||||
}
|
||||
ok ( false, s );
|
||||
}
|
||||
}("Clipperz.PM.Proxy");
|
||||
62
frontend/gamma/tests/tests/Clipperz/PM/Toll.html
Normal file
62
frontend/gamma/tests/tests/Clipperz/PM/Toll.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.Toll - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="Toll.test.js"></script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
202
frontend/gamma/tests/tests/Clipperz/PM/Toll.test.js
Normal file
202
frontend/gamma/tests/tests/Clipperz/PM/Toll.test.js
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
'simple_test': function() {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("simple_tests", {trace:false});
|
||||
deferredResult.addCallback(function() {
|
||||
var tollTargetValue;
|
||||
var toll;
|
||||
var price;
|
||||
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
|
||||
tollTargetValue = Clipperz.Crypto.SHA.sha256(tollTargetValue);
|
||||
|
||||
price = 1;
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
|
||||
toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price});
|
||||
toll.pay();
|
||||
|
||||
price = 5;
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
|
||||
toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price});
|
||||
toll.pay();
|
||||
|
||||
price = 6;
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
|
||||
toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price});
|
||||
toll.pay();
|
||||
|
||||
price = 7;
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
|
||||
toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price});
|
||||
toll.pay();
|
||||
|
||||
price = 7;
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
|
||||
toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price});
|
||||
toll.pay();
|
||||
});
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'deferredPay_test': function() {
|
||||
var deferredResult;
|
||||
var tollTargetValue;
|
||||
var toll_1, toll_5, toll_6, toll_7, toll_10, toll_16;
|
||||
|
||||
// tollTargetValue = Clipperz.Crypto.SHA.sha256(Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32));
|
||||
|
||||
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("deferredPay_tests", {trace:false});
|
||||
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
|
||||
toll_1 = new Clipperz.PM.Toll({targetValue:tollTargetValue, cost:1});
|
||||
|
||||
deferredResult.addMethod(toll_1, 'deferredPay');
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.ok(Clipperz.PM.Toll.validate(aResult.targetValue, aResult.toll, 1), "Payed a toll of cost 1");
|
||||
});
|
||||
deferredResult.addCallback(MochiKit.Async.wait, 1);
|
||||
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
|
||||
toll_5 = new Clipperz.PM.Toll({targetValue:tollTargetValue, cost:5});
|
||||
|
||||
deferredResult.addMethod(toll_5, 'deferredPay');
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.ok(Clipperz.PM.Toll.validate(aResult.targetValue, aResult.toll, 5), "Payed a toll of cost 5");
|
||||
});
|
||||
deferredResult.addCallback(MochiKit.Async.wait, 1);
|
||||
|
||||
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
|
||||
toll_6 = new Clipperz.PM.Toll({targetValue:tollTargetValue, cost:6});
|
||||
|
||||
deferredResult.addMethod(toll_6, 'deferredPay');
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.ok(Clipperz.PM.Toll.validate(aResult.targetValue, aResult.toll, 6), "Payed a toll of cost 6");
|
||||
});
|
||||
deferredResult.addCallback(MochiKit.Async.wait, 1);
|
||||
|
||||
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
|
||||
toll_7 = new Clipperz.PM.Toll({targetValue:tollTargetValue, cost:7});
|
||||
|
||||
deferredResult.addMethod(toll_7, 'deferredPay');
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.ok(Clipperz.PM.Toll.validate(aResult.targetValue, aResult.toll, 7), "Payed a toll of cost 7");
|
||||
});
|
||||
deferredResult.addCallback(MochiKit.Async.wait, 1);
|
||||
|
||||
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
|
||||
toll_10 = new Clipperz.PM.Toll({targetValue:tollTargetValue, cost:10});
|
||||
|
||||
deferredResult.addMethod(toll_10, 'deferredPay');
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.ok(Clipperz.PM.Toll.validate(aResult.targetValue, aResult.toll, 10), "Payed a toll of cost 10");
|
||||
});
|
||||
deferredResult.addCallback(MochiKit.Async.wait, 1);
|
||||
|
||||
/*
|
||||
tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
|
||||
toll_16 = new Clipperz.PM.Toll({targetValue:tollTargetValue, cost:16});
|
||||
|
||||
deferredResult.addMethod(toll_16, 'deferredPay');
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.ok(Clipperz.PM.Toll.validate(aResult.targetValue, aResult.toll, 16), "Payed a toll of cost 16");
|
||||
});
|
||||
deferredResult.addCallback(MochiKit.Async.wait, 1);
|
||||
*/
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
//#############################################################################
|
||||
|
||||
runTests = function() {
|
||||
try {
|
||||
var deferredTests;
|
||||
var aTestName;
|
||||
|
||||
deferredTests = new Clipperz.Async.Deferred("Clipperz.PM.Toll.test", {trace:false});
|
||||
|
||||
aTestName = window.location.href.match(/#.*/);
|
||||
if (aTestName && (aTestName != '#')) {
|
||||
aTestName = aTestName[0].slice(1);
|
||||
if (aTestName in tests) {
|
||||
//Clipperz.log("single test execution, via fragment identifier", aTestName);
|
||||
deferredTests.addCallback(tests[aTestName]);
|
||||
deferredTests.addErrback(SimpleTest.ok, false, aTestName);
|
||||
} else {
|
||||
deferredTests.addBoth(is, aTestName, null, "Wrong test name selected to run");
|
||||
}
|
||||
} else {
|
||||
for (aTestName in tests) {
|
||||
deferredTests.addCallback(tests[aTestName]);
|
||||
deferredTests.addErrback(SimpleTest.ok, false, aTestName);
|
||||
}
|
||||
deferredTests.addBoth(is, true, true, "FINISH: completed the full stack of tests");
|
||||
}
|
||||
deferredTests.addBoth(SimpleTest.finish);
|
||||
deferredTests.callback();
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
} catch (err) {
|
||||
var s = "test suite failure!\n";
|
||||
var o = {};
|
||||
var k = null;
|
||||
for (k in err) {
|
||||
// ensure unique keys?!
|
||||
if (!o[k]) {
|
||||
s += k + ": " + err[k] + "\n";
|
||||
o[k] = err[k];
|
||||
}
|
||||
}
|
||||
ok ( false, s );
|
||||
}
|
||||
}();
|
||||
@@ -0,0 +1,64 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.UI.Web.MainController - test</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../../../../js/JSLog/jslog.js"></script>
|
||||
<script type="text/javascript" src="../../../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/Signal.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../../../js/Clipperz/PM/UI/Web/Controllers/MainController.js'></script>
|
||||
<script type="text/javascript" src="../../../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="MainController.test.js"></script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
//Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
'isPassphraseDelegateLockSetAfterInit': function (someTestArgs) {
|
||||
return Clipperz.Async.callbacks('isPassphraseDelegateLockSetAfterInit', [
|
||||
function () {
|
||||
var mainController;
|
||||
|
||||
mainController = new Clipperz.PM.UI.Web.Controllers.MainController();
|
||||
SimpleTest.is(true, mainController._passphraseDelegateLock.locked, 'passphraseDelegate lock is locked after MainController initialization')
|
||||
}]);
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'getPassphraseWithUnsetDelegate_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var mainController;
|
||||
var delegateFunction;
|
||||
|
||||
mainController = new Clipperz.PM.UI.Web.Controllers.MainController();
|
||||
delegateFunction = function () { return "clipperz";};
|
||||
|
||||
MochiKit.Async.callLater(1, MochiKit.Base.method(mainController, 'setPassphraseDelegate', delegateFunction));
|
||||
|
||||
return Clipperz.Async.callbacks("MainController.getPassphraseWithUnsetDelegate",[
|
||||
MochiKit.Base.method(mainController, 'getPassphrase'),
|
||||
function (aResult) {
|
||||
SimpleTest.is(aResult, 'clipperz', "the password provided by the delegate is correct");
|
||||
}
|
||||
], {trace:false});
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'getPassphraseWithSetDelegate_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var mainController;
|
||||
var delegateFunction;
|
||||
|
||||
mainController = new Clipperz.PM.UI.Web.Controllers.MainController();
|
||||
delegateFunction = function () {return "clipperz";};
|
||||
|
||||
return Clipperz.Async.callbacks("MainController.getPassphraseWithSetDelegate_test",[
|
||||
MochiKit.Base.method(mainController, 'setPassphraseDelegate', delegateFunction),
|
||||
MochiKit.Base.method(mainController, 'getPassphrase'),
|
||||
function (aResult) {
|
||||
SimpleTest.is(aResult, 'clipperz', "the password provided by the delegate is correct");
|
||||
}
|
||||
], {trace:false});
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
|
||||
|
||||
//#############################################################################
|
||||
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.UI.Web.Controllers.MainController", tests, {trace:false});
|
||||
@@ -0,0 +1,46 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.UI.Web.Controllers.* - tests</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../../../SimpleTest/TestRunner.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
TestRunner.runTests(
|
||||
//
|
||||
// This is still a complete mess.
|
||||
//
|
||||
'MainController.html'
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
45
frontend/gamma/tests/tests/Clipperz/PM/UI/Web/index.html
Normal file
45
frontend/gamma/tests/tests/Clipperz/PM/UI/Web/index.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.UI.Web* - tests</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../../SimpleTest/TestRunner.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
TestRunner.runTests(
|
||||
//
|
||||
// This is still a complete mess.
|
||||
//
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
45
frontend/gamma/tests/tests/Clipperz/PM/UI/index.html
Normal file
45
frontend/gamma/tests/tests/Clipperz/PM/UI/index.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.UI.* - tests</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/TestRunner.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
TestRunner.runTests(
|
||||
//
|
||||
// This is still a complete mess.
|
||||
//
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
56
frontend/gamma/tests/tests/Clipperz/PM/index.html
Normal file
56
frontend/gamma/tests/tests/Clipperz/PM/index.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2011 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz's Javascript Crypto Library.
|
||||
Javascript Crypto Library provides web developers with an extensive
|
||||
and efficient set of cryptographic functions. The library aims to
|
||||
obtain maximum execution speed while preserving modularity and
|
||||
reusability.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com
|
||||
|
||||
* Javascript Crypto Library is free software: you can redistribute
|
||||
it and/or modify it under the terms of the GNU Affero General Public
|
||||
License as published by the Free Software Foundation, either version
|
||||
3 of the License, or (at your option) any later version.
|
||||
|
||||
* Javascript Crypto Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Javascript Crypto Library. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.* - tests</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../SimpleTest/TestRunner.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
TestRunner.runTests(
|
||||
//
|
||||
// This is still a complete mess.
|
||||
//
|
||||
// 'BookmarkletProcessor.html',
|
||||
'Connection.html',
|
||||
'Crypto.html',
|
||||
// 'Crypto_other_implementation_comparison.html',
|
||||
'Crypto_performanceEvaluation.html',
|
||||
// 'CryptoPerformance_ByteArrayArray.html',
|
||||
// 'CryptoPerformance_ByteArrayHex.html',
|
||||
// 'CryptoPerformance_ByteArrayString.html',
|
||||
'Date.html',
|
||||
'Proxy.html',
|
||||
'Toll.html'
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user