Skip to content
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

Use native aes-128-gcm support in Node 4 rather than npm-node-aes-gcm package #7548

Merged
merged 2 commits into from Aug 2, 2016

Conversation

benjamn
Copy link
Contributor

@benjamn benjamn commented Aug 2, 2016

Inspired by this comment from @glasser.

decipher.setAuthTag(new Buffer(ciphertext.authTag, "base64"));
var chunks = [decipher.update(
new Buffer(ciphertext.ciphertext, "base64"))];
chunks.push(decipher.final());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear to me at which step crypto throws or otherwise indicates decryption or authentication errors but it looks like this change does affect how errors are detected? Or do you need to add an error handler?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh never mind. I remembered that we tried to remove details from errors but not how it was implemented. Should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth, my understanding is that (de)cipher.final() throws if there are encryption/decryption errors.

@glasser
Copy link
Contributor

glasser commented Aug 2, 2016

There's also a no longer accurate comment in encrypt.js saying that the crypto API doesn't support AAD. Though I doubt we actually want to incur the compatibility issues of changing to follow the suggestion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants