1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-22 17:02:17 -05:00
mail/test/ecc-test.js

21 lines
415 B
JavaScript
Raw Normal View History

2013-03-13 11:58:46 -04:00
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);
});