integrated senderPk signature check

This commit is contained in:
Tankred Hase 2013-05-24 00:14:02 +02:00
parent dbb25162fa
commit a3ff4c48c1
1 changed files with 2 additions and 2 deletions

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