mirror of
https://github.com/moparisthebest/mail
synced 2025-02-27 08:11:44 -05:00
integrated senderPk signature check
This commit is contained in:
parent
dbb25162fa
commit
a3ff4c48c1
@ -58,8 +58,8 @@
|
|||||||
|
|
||||||
// process new values
|
// process new values
|
||||||
i.encryptedKey = rsa.encrypt(i.key);
|
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.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 old ones
|
||||||
delete i.key;
|
delete i.key;
|
||||||
delete i.receiverPk;
|
delete i.receiverPk;
|
||||||
@ -90,7 +90,7 @@
|
|||||||
rsa.init(pk.publicKey);
|
rsa.init(pk.publicKey);
|
||||||
|
|
||||||
// verify signature
|
// 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!');
|
throw new Error('Verifying RSA signature failed!');
|
||||||
}
|
}
|
||||||
// process new values
|
// process new values
|
||||||
|
Loading…
x
Reference in New Issue
Block a user