Decrypting anything other than plain text #1284
-
I have a node (electron) application that uses openpgpjs. When decrypting txt files everything works fine, but when trying to decrypt any other file type it outputs invalid files. After troubleshooting the encryption and decryption along with other programs I know that the files are encrypting properly but when it comes to decryption that is where things stray. I have combed through documentation, issues, & prs trying to see if I can find anything that would help but I have not seen anything yet. This is the code that I use to decrypt files. By all means I could be over looking something obvious... decryptFile: async (keyFilePath, isBinary, passphrase, fileEncrypted) => {
const privateKey = await readKeyFile(keyFilePath, isBinary);
await privateKey.decrypt(passphrase);
console.log("after privateKey");
console.log(fileEncrypted);
const binaryMessage = fs.readFileSync(fileEncrypted);
const message = await openpgp.readMessage({ binaryMessage });
return openpgp.decrypt({ message, privateKeys: privateKey });
}, Ultimately I would like to decrypt any file type but the pressing issue is decrypting zip files. Any comments, suggestions, or help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey 👋 Try passing |
Beta Was this translation helpful? Give feedback.
Hey 👋 Try passing
format: 'binary'
toopenpgp.decrypt