-
Notifications
You must be signed in to change notification settings - Fork 86
Example for using multiple keys in multiple regions #177
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
Conversation
…yption-sdk-python into a1b1c1-example
Please run: tox -re autoformat
tox -re "{flake8,pylint}-examples" |
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.
Thanks for the contribution!
In addition to the comments below, please make sure you run tox -re autoformat
.
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.
Great start, let me know if you need help in identifying the different scenarios to test.
… still working on populating the tests correctly, so the CI will fail, but I tested the code with my own KMS CMK ARNs, so I know it will work once the tests are populated (working with Tejeswini on this)
…d test keys in different regions for this example
) | ||
|
||
# Check that the original message and the decrypted message are the same | ||
assert source_plaintext == plaintext1 |
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.
The output of the decrypt
function will always be bytes.
source_plaintext
might not be bytes.
Before this check, let's add a decoding if necessary:
if not isinstance(source_plaintext, bytes):
plaintext1 = plaintext1.decode("utf-8")
plaintext2 = plaintext2.decode("utf-8")
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.
Does this make the assumption that source_plaintext
is either bytes
or str
?
:/ I think I may have broken this PR by changing it to point at I'll see if I can merge this into my examples branch and still retain the authorship. |
That does appear to have worked. :) I'll fix up the things that were blocking this merging and incorporate it into my examples revamp. I'll close this PR once I cut that one. |
This is now merged in #219. Thanks @caitlin-tibbetts and sorry this took so long. :) |
Issue #156, example A2.B1.C1
Added an example and a test for when multiple keys in multiple regions are used to encrypt and decrypt a passed-in message.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.