1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-25 18:32:20 -05:00

integrated senderPk signature check

This commit is contained in:
Tankred Hase 2013-05-24 00:14:02 +02:00
parent dbb25162fa
commit a3ff4c48c1

View File

@ -58,8 +58,8 @@
// process new values
i.encryptedKey = rsa.encrypt(i.key);
i.signature = rsa.sign([i.iv, util.str2Base64(i.id), i.encryptedKey, i.ciphertext]);
i.senderPk = senderPrivkey._id;
i.signature = rsa.sign([i.iv, util.str2Base64(i.id), util.str2Base64(i.senderPk), i.encryptedKey, i.ciphertext]);
// delete old ones
delete i.key;
delete i.receiverPk;
@ -90,7 +90,7 @@
rsa.init(pk.publicKey);
// verify signature
if (!rsa.verify([i.iv, util.str2Base64(i.id), i.encryptedKey, i.ciphertext], i.signature)) {
if (!rsa.verify([i.iv, util.str2Base64(i.id), util.str2Base64(i.senderPk), i.encryptedKey, i.ciphertext], i.signature)) {
throw new Error('Verifying RSA signature failed!');
}
// process new values