Skip to content

chore(README): update README.md #1940

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

Merged
merged 9 commits into from
Feb 5, 2024
Merged

chore(README): update README.md #1940

merged 9 commits into from
Feb 5, 2024

Conversation

imabhichow
Copy link
Contributor

Issue #, if available:

Description of changes:

  • update README.md

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

@imabhichow imabhichow requested a review from a team as a code owner January 10, 2024 01:05
@imabhichow imabhichow changed the title chore: update README.md chore(README): update README.md Jan 10, 2024

// Encrypt the data
//
final CryptoResult<byte[], KmsMasterKey> encryptResult = crypto.encryptData(prov, plaintext.getBytes(StandardCharsets.UTF_8), context);
final CryptoResult<byte[], ?> encryptResult = crypto.encryptData(kmsKeyring, plaintext.getBytes(StandardCharsets.UTF_8), encryptionContext);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the ? in
CryptoResult<byte[], ?>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ? is a wild card to keep encryptData API compatible with previous releases.

ESDK-Java's CryptoResult includes a definition of the actual Cryptographic Material Provider (MasterKey or MasterKeyProvider) as a Generic that can be refined at class initialization.

I am not sure if we ever refactored that CryptoResult class so
IKeyring or ICryptographicMaterialProvider could refine the Generic...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We clearly did not:
https://github.com/aws/aws-encryption-sdk-java/blob/master/src/main/java/com/amazonaws/encryptionsdk/CryptoResult.java#L31

This means that following APIs are now broken for Keyring users:

Which... is not Great.
@imabhichow we should bring this up at Stand up.

Those APIs are NOT critical; one of them is even marked as deprecated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which... is not Great.

Looking into the details here, this is not bad or even an issue.

K is would be an explicit MasterKey.
If no MaterKey or MasterKeyProviders are used,
then no one SHOULD expect a list of MasterKeyIDs to be populated.

We should probably write a test to assert that nothing wild happens,
like an Exception.

Copy link
Contributor Author

@imabhichow imabhichow Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using keyrings, the CryptoResult.getMasterKeyIds method returns an empty list during encryption.

However, during decryption, CryptoResult.getMasterKeyIds throws a NULL POINTER EXCEPTION. This could be due to returning a DataKey with the master key set to null. I suppose we should expect similar behavior to encryption which is returning an empty llist of masterkeys. I'll try to look more into this.

I also think we should deprecate this method CryptoResult.getMasterKeyIds

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have, yes.
And we should cut a PR to prevent the NPE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this pull request, CryptoResult.getMasterKeyIds is now deprecated and will return an empty list when we use keyrings.

@imabhichow imabhichow merged commit 7a0899e into master Feb 5, 2024
@imabhichow imabhichow deleted the imabhichow/readme branch February 5, 2024 19:09
josecorella pushed a commit that referenced this pull request Jun 12, 2024
## [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))
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.

4 participants