Skip to content

Throw a more useful exception when trying to use the RawRsaKeyring to encrypt without a public key #180

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 2 commits into from
Apr 23, 2020

Conversation

WesleyRosenblum
Copy link
Contributor

Issue #, if available:

Description of changes:

Currently we rely on the JCE Cipher class to throw an exception when a user tries to encrypt with the RawRsaKeyring but has not configured a public key. The exception message does not obviously indicate what is wrong, so this change will explicitly check for a missing public key before attempting encryption and throw a more useful exception.

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.

mattsb42-aws
mattsb42-aws previously approved these changes Apr 23, 2020
Copy link
Member

@mattsb42-aws mattsb42-aws left a comment

Choose a reason for hiding this comment

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

I don't love the coarse granularity of our exceptions, but otherwise LGTM.

@WesleyRosenblum WesleyRosenblum merged commit 997e80b into master Apr 23, 2020
@WesleyRosenblum WesleyRosenblum deleted the rawrsaexception branch April 23, 2020 18:12
WesleyRosenblum added a commit that referenced this pull request Apr 23, 2020
… encrypt without a public key (#180)

* Throw a more useful exception when trying to use the RawRsaKeyring to encrypt without a public key

* Add a test for trying to decrypt without a private key
WesleyRosenblum added a commit that referenced this pull request Apr 24, 2020
…he AWS KMS keyring (#178)

* Add an example for replicating the behavior of the AWS KMS MKP

* Rewording based on feedback

* Updating based on python example updates

* Matching python wording

* Throw a more useful exception when trying to use the RawRsaKeyring to encrypt without a public key (#180)

* Throw a more useful exception when trying to use the RawRsaKeyring to encrypt without a public key

* Add a test for trying to decrypt without a private key

* Update src/examples/java/com/amazonaws/crypto/examples/keyring/awskms/ActLikeAwsKmsMasterKeyProvider.java

Co-Authored-By: Matt Bullock <[email protected]>

Co-authored-by: Matt Bullock <[email protected]>
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