-
Notifications
You must be signed in to change notification settings - Fork 63
fix: browser-encrypt can encrypt 0 bytes #866
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
fix: browser-encrypt can encrypt 0 bytes #866
Conversation
Browser encryption now correctly encrypts 0 byte messages. Added structural tests for both Node.js and browser `encrypt`.
@@ -370,6 +370,34 @@ describe('encrypt structural testing', () => { | |||
// This will throw if it does not deserialize correctly | |||
deserializeSignature(footerSection) | |||
}) | |||
|
|||
it('can encrypt empty message', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: any reason to check the encryption context and EDKs in the browser version of this test but not the Node version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a miss, inc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to elaborate more, when encrypting 0 bytes, the only part of the message that is relevant is the encryption context :)
Co-authored-by: Alex Chew <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Browser encryption now correctly encrypts 0 byte messages.
Added structural tests for both Node.js and browser
encrypt
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Check any applicable: