refactored crypto api to use forge cbc mode instead of sjcl

This commit is contained in:
Tankred Hase 2013-05-14 14:05:14 +02:00
parent 3e12c7eae6
commit c89569fabd
5 changed files with 12 additions and 22 deletions

View File

@ -2,14 +2,9 @@
'use strict';
// import web worker dependencies
importScripts('../../lib/sjcl/sjcl.js');
importScripts('../../lib/sjcl/bitArray.js');
importScripts('../../lib/sjcl/codecBase64.js');
importScripts('../../lib/sjcl/codecString.js');
importScripts('../../lib/sjcl/aes.js');
importScripts('../../lib/sjcl/ccm.js');
importScripts('../../lib/forge/forge.rsa.bundle.js');
importScripts('../app-config.js');
importScripts('./aes-ccm.js');
importScripts('./aes-cbc.js');
importScripts('./util.js');
/**
@ -20,7 +15,7 @@
var args = e.data,
output = null,
aes = new app.crypto.AesCCM(sjcl),
aes = new app.crypto.AesCBC(forge),
util = new app.crypto.Util(null, null);
if (args.type === 'encrypt' && args.list) {

View File

@ -2,14 +2,9 @@
'use strict';
// import web worker dependencies
importScripts('../../lib/sjcl/sjcl.js');
importScripts('../../lib/sjcl/bitArray.js');
importScripts('../../lib/sjcl/codecBase64.js');
importScripts('../../lib/sjcl/codecString.js');
importScripts('../../lib/sjcl/aes.js');
importScripts('../../lib/sjcl/ccm.js');
importScripts('../../lib/forge/forge.rsa.bundle.js');
importScripts('../app-config.js');
importScripts('./aes-ccm.js');
importScripts('./aes-cbc.js');
/**
* In the web worker thread context, 'this' and 'self' can be used as a global
@ -19,7 +14,7 @@
var args = e.data,
output = null,
aes = new app.crypto.AesCCM(sjcl);
aes = new app.crypto.AesCBC(forge);
if (args.type === 'encrypt' && args.plaintext && args.key && args.iv) {
// start encryption

View File

@ -7,7 +7,7 @@ app.crypto.Crypto = function(window, util) {
var symmetricUserKey = null, // the user's secret key used to encrypt item-keys
keyId = null, // the key ID linking the user's key set
aes = new app.crypto.AesCCM(sjcl); // use authenticated AES-CCM mode by default
aes = new app.crypto.AesCBC(forge); // use AES-CBC mode by default
/**
* Initializes the crypto modules by fetching the user's

View File

@ -4,7 +4,7 @@ var crypto_test = {
user: 'crypto_test@example.com',
password: 'Password',
keySize: 128,
ivSize: 104
ivSize: 128
};
asyncTest("Init", 2, function() {
@ -54,7 +54,7 @@ asyncTest("En/Decrypt for User", 4, function() {
});
});
asyncTest("CCM mode (Async/Worker)", 2, function() {
asyncTest("AES (Async/Worker)", 2, function() {
var secret = 'Big secret';
var key = crypto_test.util.random(crypto_test.keySize);
@ -71,7 +71,7 @@ asyncTest("CCM mode (Async/Worker)", 2, function() {
});
});
asyncTest("CCM batch mode (Async/Worker)", 5, function() {
asyncTest("AES batch (Async/Worker)", 5, function() {
// generate test data
var collection, list, td = new TestData();
@ -92,7 +92,7 @@ asyncTest("CCM batch mode (Async/Worker)", 5, function() {
});
});
asyncTest("CCM batch mode for User (Async/Worker)", 5, function() {
asyncTest("AES batch for User (Async/Worker)", 5, function() {
// generate test data
var collection, list, td = new TestData();

View File

@ -4,7 +4,7 @@ var emaildao_test = {
user: 'test@atlasdev.onmicrosoft.com',
password: 'Xoza76645',
keySize: 128,
ivSize: 104
ivSize: 128
};
asyncTest("Init", 2, function() {