Skip to content

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.

3 participants