mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Fixed PGP functionality in 1.8+ (Closes #464)
This commit is contained in:
parent
e96f297def
commit
fdf3b614b4
2 changed files with 7 additions and 85 deletions
|
|
@ -821,15 +821,15 @@
|
|||
|
||||
DataUserStorage.prototype.findPublicKeysByEmail = function (sEmail)
|
||||
{
|
||||
var self = this;
|
||||
return _.compact(_.map(require('Stores/User/Pgp').openpgpkeysPublic(), function (oItem) {
|
||||
var PgpStore = require('Stores/User/Pgp');
|
||||
return _.compact(_.map(PgpStore.openpgpkeysPublic(), function (oItem) {
|
||||
|
||||
var oKey = null;
|
||||
if (oItem && sEmail === oItem.email)
|
||||
{
|
||||
try
|
||||
{
|
||||
oKey = self.openpgp.key.readArmored(oItem.armor);
|
||||
oKey = PgpStore.openpgp.key.readArmored(oItem.armor);
|
||||
if (oKey && !oKey.err && oKey.keys && oKey.keys[0])
|
||||
{
|
||||
return oKey.keys[0];
|
||||
|
|
@ -851,9 +851,9 @@
|
|||
DataUserStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
PgpStore = require('Stores/User/Pgp'),
|
||||
oPrivateKey = null,
|
||||
oKey = _.find(require('Stores/User/Pgp').openpgpkeysPrivate(), function (oItem) {
|
||||
oKey = _.find(PgpStore.openpgpkeysPrivate(), function (oItem) {
|
||||
return oItem && sEmail === oItem.email;
|
||||
})
|
||||
;
|
||||
|
|
@ -862,7 +862,7 @@
|
|||
{
|
||||
try
|
||||
{
|
||||
oPrivateKey = self.openpgp.key.readArmored(oKey.armor);
|
||||
oPrivateKey = PgpStore.openpgp.key.readArmored(oKey.armor);
|
||||
if (oPrivateKey && !oPrivateKey.err && oPrivateKey.keys && oPrivateKey.keys[0])
|
||||
{
|
||||
oPrivateKey = oPrivateKey.keys[0];
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
function PgpUserStore()
|
||||
{
|
||||
this.capaOpenPGP = ko.observable(false);
|
||||
|
||||
|
||||
this.openpgp = null;
|
||||
|
||||
this.openpgpkeys = ko.observableArray([]);
|
||||
|
|
@ -27,84 +27,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
// PgpUserStore.prototype.sign = function (sText, oPrivateKey)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// return this.openpgp.signClearMessage([oPrivateKey], sText);
|
||||
// }
|
||||
// catch (oExc) {}
|
||||
//
|
||||
// return sText;
|
||||
// };
|
||||
//
|
||||
// PgpUserStore.prototype.encrypt = function (sText, aPublicKeys)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// return this.openpgp.encryptMessage(aPublicKeys, sText);
|
||||
// }
|
||||
// catch (oExc) {}
|
||||
//
|
||||
// return sText;
|
||||
// };
|
||||
//
|
||||
// PgpUserStore.prototype.signAndEncrypt = function (sText, aPublicKeys, oPrivateKey)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// return this.openpgp.signAndEncryptMessage(aPublicKeys, oPrivateKey, sText);
|
||||
// }
|
||||
// catch (oExc) {}
|
||||
//
|
||||
// return sText;
|
||||
// };
|
||||
//
|
||||
// /**/
|
||||
//
|
||||
// PgpUserStore.prototype.verify = function (sText, aPublicKeys)
|
||||
// {
|
||||
// var
|
||||
// mPgpMessage = null
|
||||
// ;
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// mPgpMessage = this.openpgp.cleartext.readArmored(sText);
|
||||
// if (mPgpMessage && mPgpMessage.getText)
|
||||
// {
|
||||
// mPgpMessage.verify(aPublicKeys);
|
||||
// }
|
||||
// }
|
||||
// catch (oExc) {}
|
||||
//
|
||||
// return false;
|
||||
// };
|
||||
//
|
||||
// PgpUserStore.prototype.decryptAndVerify = function (sEnctyptedText, aPublicKeys, oPivateKey)
|
||||
// {
|
||||
// var
|
||||
// mPgpMessageDecrypted = null,
|
||||
// mPgpMessage = null
|
||||
// ;
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// mPgpMessage = this.openpgp.message.readArmored(sEnctyptedText);
|
||||
// if (mPgpMessage && oPivateKey && mPgpMessage.decrypt)
|
||||
// {
|
||||
// mPgpMessageDecrypted = mPgpMessage.decrypt(oPivateKey);
|
||||
// if (mPgpMessageDecrypted)
|
||||
// {
|
||||
// mPgpMessageDecrypted.verify(aPublicKeys);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (oExc) {}
|
||||
//
|
||||
// return false;
|
||||
// };
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue