forge test update

This commit is contained in:
Tankred Hase 2013-05-13 17:29:02 +02:00
parent e3ce4df5bb
commit 184b9a6d3b
1 changed files with 17 additions and 17 deletions

View File

@ -51,6 +51,11 @@ test("RSA Verify", 1, function() {
ok(res);
});
var forge_aes_test = {
keySize: 128,
test_message: new TestData().generateBigString(1000)
};
test("HMAC SHA-256", 1, function() {
var util = new app.crypto.Util(window, uuid);
@ -60,28 +65,12 @@ test("HMAC SHA-256", 1, function() {
var hmac = forge.hmac.create();
hmac.start('sha256', key);
hmac.update(iv);
hmac.update(rsa_test.test_message);
hmac.update(forge_aes_test.test_message);
var result = hmac.digest().toHex();
ok(result);
});
test("PBKDF2", 1, function() {
var util = new app.crypto.Util(window, uuid);
var salt = util.base642Str("vbhmLjC+Ub6MSbhS6/CkOwxB25wvwRkSLP2DzDtYb+4=");
var expect = '5223bd44b0523090b21e9d38a749b090';
var dk = forge.pkcs5.pbkdf2('password', salt, 1000, 16);
equal(expect, forge.util.bytesToHex(dk));
});
var forge_aes_test = {
keySize: 128,
test_message: new TestData().generateBigString(1000)
};
test("AES-128-CBC En/Decrypt", 1, function() {
var util = new app.crypto.Util(window, uuid);
@ -102,4 +91,15 @@ test("AES-128-CBC En/Decrypt", 1, function() {
deCipher.finish();
equal(input, deCipher.output, 'En/Decrypt');
});
test("PBKDF2", 1, function() {
var util = new app.crypto.Util(window, uuid);
var salt = util.base642Str("vbhmLjC+Ub6MSbhS6/CkOwxB25wvwRkSLP2DzDtYb+4=");
var expect = '5223bd44b0523090b21e9d38a749b090';
var dk = forge.pkcs5.pbkdf2('password', salt, 1000, 16);
equal(expect, forge.util.bytesToHex(dk));
});