Skip to content

Commit

Permalink
fix js
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Feb 5, 2024
1 parent 161c6ad commit 8f837a7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ async function do_decrypt(jsonContent) {
return;
} else {
el.style.visibility = "hidden";
const keyLength = privateKey.n.bitLength() / 8
const decrypted = privateKey.decrypt(encrypted.substring(0, privateKey.n.bitLength() / 8 ), 'RSA-OAEP');
const keyLength = privateKey.n.bitLength() / 8;
const decrypted = privateKey.decrypt(encrypted.substring(0, keyLength ), 'RSA-OAEP');
const aes_key = decrypted.substring(0, 16);
const iv = decrypted.substring(16, 32);
const decipher = forge.cipher.createDecipher('AES-CBC', aes_key);
decipher.start({iv: iv});
decipher.update(forge.util.createBuffer(encrypted.substring(privateKey.n.bitLength() / 8)));
decipher.update(forge.util.createBuffer(encrypted.substring(keyLength)));
const result = decipher.finish(); // check 'result' for true/false
// outputs decrypted hex
// Create regex patterns for replacing unwanted characters in file name
Expand Down

0 comments on commit 8f837a7

Please sign in to comment.