1
0
mirror of https://github.com/moparisthebest/mail synced 2024-08-13 16:43:47 -04:00
mail/test/ecc-test.js
2013-03-13 16:58:46 +01:00

21 lines
415 B
JavaScript

module("ECC Crypto");
var keys,
ciphertext,
plaintext = 'Hello, World!';
test("Generate Keys", function() {
// generate keypair
keys = sjcl.ecc.elGamal.generateKeys(384, 1);
ok(keys);
});
test("Encrypt", function() {
ciphertext = sjcl.encrypt(keys.pub, plaintext);
ok(ciphertext);
});
test("Decrypt", function() {
var decrypted = sjcl.decrypt(keys.sec, ciphertext);
equal(plaintext, decrypted);
});