mirror of
https://github.com/moparisthebest/mail
synced 2024-11-22 08:52:15 -05:00
removed redundant keypair reference in crypto
This commit is contained in:
parent
c9c53598e8
commit
413a99a04f
@ -5,8 +5,7 @@
|
|||||||
app.crypto.Crypto = function(window, util) {
|
app.crypto.Crypto = function(window, util) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var keypair = null, // the user's keys used to encrypt item-keys
|
var aes = new app.crypto.AesCBC(forge), // use AES-CBC mode by default
|
||||||
aes = new app.crypto.AesCBC(forge), // use AES-CBC mode by default
|
|
||||||
rsa = new app.crypto.RSA(forge, util); // use RSA for asym. crypto
|
rsa = new app.crypto.RSA(forge, util); // use RSA for asym. crypto
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +46,7 @@ app.crypto.Crypto = function(window, util) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
keypair = rsa.exportKeys();
|
var keypair = rsa.exportKeys();
|
||||||
|
|
||||||
// encrypt keypair
|
// encrypt keypair
|
||||||
var iv = util.random(self.ivSize);
|
var iv = util.random(self.ivSize);
|
||||||
@ -69,7 +68,7 @@ app.crypto.Crypto = function(window, util) {
|
|||||||
function decryptKeypair(storedKeypair, pbkdf2) {
|
function decryptKeypair(storedKeypair, pbkdf2) {
|
||||||
try {
|
try {
|
||||||
var keypairJson = aes.decrypt(storedKeypair.encryptedKeys, pbkdf2, storedKeypair.keyIV);
|
var keypairJson = aes.decrypt(storedKeypair.encryptedKeys, pbkdf2, storedKeypair.keyIV);
|
||||||
keypair = JSON.parse(keypairJson);
|
var keypair = JSON.parse(keypairJson);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
callback({
|
callback({
|
||||||
errMsg: 'Wrong password!'
|
errMsg: 'Wrong password!'
|
||||||
|
Loading…
Reference in New Issue
Block a user