-
Notifications
You must be signed in to change notification settings - Fork 65
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
feat: Support sha256 and sha512 oaep algorithms #240
Commits on Jan 15, 2020
-
test: broken test with UnhandledPromiseRejection
We want to check that the async onDecrypt function returns a promise that rejects. We were trying to use chai-as-promised's rejectedWith matcher for this, but within an `async` function. It looks like mocha isn't clever enough to wait for the promise to reject and run the assertion unless we return the promise from the function. It prints a warning about the uncaught promise rejection instead. Once we fix the test to return the promise it fails, because the promise is not actually being rejected, so I'm excluding it while I work on a fix.
Configuration menu - View commit details
-
Copy full SHA for 310a767 - Browse repository at this point
Copy the full SHA 310a767View commit details -
test: test private key must be defined
This test was excluded because the precondition wasn't hit when calling `keyring.onDecrypt` (I think due to another precondition somewhere else). It might be a bit sneaky to call the "private" method (`_unwrapKey`) in the tests, but it hits the precondition we're trying to test more directly.
Configuration menu - View commit details
-
Copy full SHA for 0a3107b - Browse repository at this point
Copy the full SHA 0a3107bView commit details -
feat: Support sha256 and sha512 oaep algorithms
This is particularly useful because CloudFront's Field Level Encryption uses RSA_OAEP_SHA256_MGF1, which this library doesn't support yet. Support for oaepHash was added in node 12.9 (nodejs/node#28335), so this won't work for older node versions. It's still a backwards compatible change because by default `oaepHash` will be undefined, as before. I've updated the tests to cover use of the new parameter, but they're not very strict because they both encrypt and decrypt using the same parameter. This means if node silently ignores the oaepHash parameter (as it will in versions < 12.9) the tests will still pass, which isn't great. On the other hand, I think this project may still be being tested on an older version of node, so perhaps the fact the tests won't break is an unexpected blessing. I've also tested this manually against AWS CloudFront's Field Level Encryption and it seems to work. Resolves aws#198
Configuration menu - View commit details
-
Copy full SHA for 3065ac0 - Browse repository at this point
Copy the full SHA 3065ac0View commit details
Commits on Jan 16, 2020
-
feat: add support for oaep sha384
Judging from the types in the test, this is supported by other libraries, and it looks like it also works in node.
Configuration menu - View commit details
-
Copy full SHA for 01741ce - Browse repository at this point
Copy the full SHA 01741ceView commit details -
test: support OAEP hashes in integration tests
I haven't been able to run these tests myself to confirm they work because there's a fair bit of setup I don't know how to do. I'd expect the tests to fail on versions of node < 12.9, which may be a problem for CI.
Configuration menu - View commit details
-
Copy full SHA for 77c9934 - Browse repository at this point
Copy the full SHA 77c9934View commit details -
Configuration menu - View commit details
-
Copy full SHA for d8caf36 - Browse repository at this point
Copy the full SHA d8caf36View commit details
Commits on Jan 21, 2020
-
fix: oaepHash feature detection
It is important to be perscriptive in what options will work. Node.js versions that do not support `oaepHash` will silently encrypt data. This means that the encrypted data key would not have the security properties requested. So, `oaep_hash_supported.ts` will attempt to encrypt and report the success. This will happen only once, on initializaion. Both the tests, and the integration tests have been updated honor `oaepHashSupported` values
Configuration menu - View commit details
-
Copy full SHA for 8cd6b26 - Browse repository at this point
Copy the full SHA 8cd6b26View commit details