Cryptex
Cryptex copied to clipboard
Fix issue with AES 256 breaking when running in Electron
The name used for the AES 256 algorithm will break Cryptex when used in Electron 73. It seems like the fix to this issue is by changing the algorithm name to aes-256-cbc
for the crypto package to work. Otherwise, an "Unknown Cipher" error message will be thrown.
This PR attempts to detect whether the environment is Electron or not. If it is, we will use aes-256-cbc
as the algorithm name. Otherwise, we will use aes256
in a regular Node environment.
@TomFrost It would be great if I could have this PR reviewed and merged because this will help many Electron projects to continue using Cryptex. Thanks!
Hi @superical, thanks for this! It looks like the only thing necessary to fix the build is npm run format
. I can run that when I'm home, but if you'd like to add that then I can merge and release now.
Actually, circling back, is the issue that electron doesn't include/blocks the aes256
cipher? I'm curious why that doesn't work if Node, ultimately, is what's supplying the ciphers.
If possible, it might make sense to use https://nodejs.org/api/crypto.html#crypto_crypto_getciphers to make the determination, rather than sniffing for signs of electron.
@TomFrost I agree that it makes more sense to use that. I will check on that and probably update the PR again very soon.