Skip to content

Common Builder for Default & Async #63

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

Closed
wants to merge 8 commits into from

Conversation

imabhichow
Copy link
Contributor

Issue #, if available:

Description of changes:

  • Implement Instruction Mode for Async

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

return haveOneNonNull;
}

static CryptographicMaterialsManager checkCMM(CryptographicMaterialsManager _cryptoMaterialsManager, Keyring _keyring, SecretKey _aesKey, PartialRsaKeyPair _rsaKeyPair, String _kmsKeyId, boolean _enableLegacyUnauthenticatedModes, SecureRandom _secureRandom, Provider _cryptoProvider) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmmmmmmmmmmm.........

I like that this reduces duplication a lot...but I don't like that it's a method with like 8 parameters...

I believe that there is a cleaner solution available, but I am not sure what it is right now...I'm thinking something like how the keyring's builder(s) work(s), where all the common stuff between sync and async exists in a base class which sync/async extend from, so we can use inheritance instead of composition (current approach) and not have to move around so many fields.

I do think that this change moves us in the right direction, and I don't think now is the right time to spend awhile figuring out a better solution, so I won't propose any changes. But I don't think this is what the final code should look like..

For now, I will say we should at least rename this to buildCMM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed.

Comment on lines 365 to 361
if (onlyOneNonNull(_cryptoMaterialsManager, _keyring, _aesKey, _rsaKeyPair, _kmsKeyId)) {
if (S3EncryptionClientUtilities.onlyOneNonNull(_cryptoMaterialsManager, _keyring, _aesKey, _rsaKeyPair, _kmsKeyId)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - since I think we need to refactor again, don't worry about doing this now, unless you want to, but we might as well move checkKeyOptions() itself into the util class (or at least move the exception throw inside)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried moving checkKeyOptions() but there are _cryptoMaterialsManager etc. which are required. Moving exception will be good, but I thought it does not reduce much code.

@imabhichow imabhichow changed the title Implement Instruction Mode for Async Common Builder for Default & Async Feb 7, 2023
@imabhichow imabhichow closed this Feb 7, 2023
@imabhichow imabhichow deleted the imabhichow-async-instrcution-mode branch May 25, 2023 23:17
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.

2 participants