-
Notifications
You must be signed in to change notification settings - Fork 123
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: Update DecryptionMaterials code to support legacy custom CMMs #2037
Conversation
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.
Lucas, you nailed it.
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.
Praise: These are excellent unit tests with clear and concise docs strings to describe what they test and how.
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.
I know you will need it again, but it looks good
src/main/java/com/amazonaws/encryptionsdk/model/DecryptionMaterials.java
Show resolved
Hide resolved
/* | ||
This is a copy-paste of the DefaultCryptoMaterialsManager implementation | ||
from the final commit of the V2 ESDK: 1870a082358d59e32c60d74116d6f43c0efa466b | ||
ESDK V3 implicitly changed the contract between CMMs and the ESDK. | ||
After V3, DecryptMaterials has an `encryptionContext` attribute, | ||
and CMMs are expected to set this attribute. | ||
The V3 commit modified this DefaultCMM's `decryptMaterials` implementation | ||
to set encryptionContext on returned DecryptionMaterials objects. | ||
However, there are custom implementations of the legacy native CMM | ||
that do not set encryptionContext. | ||
This CMM is used to explicitly assert that the V2 implementation of | ||
the DefaultCMM is compatible with V3 logic, | ||
which implicitly asserts that custom implementations of V2-compatible CMMs | ||
are also compatible with V3 logic. | ||
*/ |
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.
Nice comment.
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
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
import org.junit.Test; |
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.
TBH, I prefer that we keep these. But I don't know how to make that work, or want to block on it.
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.
We are keeping these! They just got moved to the top of the file in checkstyle reformatting
## [3.0.1](v3.0.0...v3.0.1) (2024-06-12) ### Fixes * Add Locale.ROOT to String uppercase conversions ([#1880](#1880)) ([9a9950e](9a9950e)), closes [#1879](#1879) * Update DecryptionMaterials code to support legacy custom CMMs ([#2037](#2037)) ([8807d79](8807d79)) ### Maintenance * deprecate getMasterKeyIds() in CryptoResult ([#1976](#1976)) ([1890ebb](1890ebb)) * **deps:** bump bcprov-jdk18on from 1.77 to 1.78.1 ([#2032](#2032)) ([713ca11](713ca11)) * **deps:** udpate org.bouncycastle to bcprov-jdk18on ([#1891](#1891)) ([32a92a9](32a92a9)) * **deps:** update dependencies ([#1973](#1973)) ([800bd01](800bd01)) * **Examples:** Customize KMS Client ([#2001](#2001)) ([e94ee85](e94ee85)) * fix release script ([#1912](#1912)) ([57e8a0b](57e8a0b)) * **README:** update README.md ([#1940](#1940)) ([7a0899e](7a0899e)) * update node version in version step ([#1959](#1959)) ([905385d](905385d)) * Update SUPPORT_POLICY.rst ([#1924](#1924)) ([57e40b5](57e40b5))
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Check any applicable: