-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
crypto: throw error in CipherBase::SetAutoPadding #9405
Conversation
Tagging this as |
Needs docs and tests |
2cf16d8
to
abc29e8
Compare
updated |
const cipher = crypto.createCipher('aes-256-gcm', key); | ||
cipher.setAAD(aadbuf); | ||
cipher.setAutoPadding(); | ||
assert.throws(() => cipher.getAuthTag(), Error); |
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.
If you assert on the error message instead of just the Error
constructor, it gives us better detection of things like error message changes (which are semver major). It also verifies that we got the error we planned for.
abc29e8
to
4c04d3e
Compare
4c04d3e
to
e06b6c2
Compare
Throw error after calling CipherBase#final
e06b6c2
to
2f83f0e
Compare
Rebased and fix lint errors. |
Landed in e90f382, thanks for the PR! |
Throw error after calling CipherBase#final PR-URL: #9405 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Throw error after calling CipherBase#final PR-URL: nodejs#9405 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
The previous commit is a back-port of pull request nodejs#13821 to v6.x. Its regression test does not apply to the v6.x branch (depends on semver-major pull request nodejs#9405) so this commit adds a new test. Refs: nodejs#13821 Refs: nodejs#9405
Checklist
Affected core subsystem(s)
crypto
Description of change
Throw error after calling
CipherBase#final
as inCipherBase::SetAAD
,CipherBase::SetAuthTag
,CipherBase::GetAuthTag
.