-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should the cipher-object be created with an IV? #1
Comments
To be clear: if two ciphertexts use the same IV across ciphertexts with CTR, you basically have no encryption, as C1^C2=P1^P2, where Cs are the ciphertexts and Ps are the plaintexts. |
IV doesn't have to be secure, but it has to be securely random on every re-encryption. |
@sgdread Technically for CTR mode, it only needs to be unique and not necessarily random or unpredictable — it's a nonce, not an IV. |
This is an important implementation issue! I'm currently traveling and will try to push a fix out asap. |
Thanks for your input. The issue is fixed with ef8bc9a. We also changed the block cipher mode of operation to GCM. The encryption (and decryption code) are moved to utils.js line 19. |
I'll start by saying I'm not a crypto expert by any means.
However, it was pointed out on HN that the encrypt function doesn't use an IV when initializing the cipher object, and the node documention explicitly says
Since the official docs appears to recommend against
crypto.createCipher()
I figured it was worth bringing up.The text was updated successfully, but these errors were encountered: