-
Notifications
You must be signed in to change notification settings - Fork 42
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
rsa bindings #511
rsa bindings #511
Conversation
awscrt/crypto.py
Outdated
return RSA(native_handle=_awscrt.rsa_public_key_from_pem_data(pem_data)) | ||
|
||
def encrypt(self, encryption_algorithm: RSAEncryptionAlgorithmType, | ||
plaintext: Union[str, bytes, bytearray, memoryview]) -> bytes: |
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.
debatable: while it seems OK to accepting str
when reading pem data, I'm not sure we want to accept str
for encrypt/decrypt/sign/verify. It does introduce some ambiguity if, for whatever reason, the user had some other string encoding going on
we would enforce this is C by taking y#
instead of s#
https://docs.python.org/3/c-api/arg.html
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.
str probably makes sense for plaintext. but for ciphertext i agree removing str makes more sense. updating 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.
roundtrip questions... maybe not string... we talked
Co-authored-by: Michael Graeb <[email protected]>
Co-authored-by: Michael Graeb <[email protected]>
Co-authored-by: Michael Graeb <[email protected]>
Co-authored-by: Michael Graeb <[email protected]>
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.
fix & ship
awscrt/crypto.py
Outdated
class RSA: | ||
def __init__(self, native_handle): | ||
""" | ||
don't call me, I'm private | ||
""" | ||
self._rsa = native_handle |
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.
It's possible that adding actual docstrings makes it public. run scripts/make-docs.py to see what the docs look like
class RSA(NativeResource):
def __init__(self, binding):
super().__init__()
self._binding = binding
awscrt/crypto.py
Outdated
return RSA(native_handle=_awscrt.rsa_public_key_from_pem_data(pem_data)) | ||
|
||
def encrypt(self, encryption_algorithm: RSAEncryptionAlgorithmType, | ||
plaintext: Union[str, bytes, bytearray, memoryview]) -> bytes: |
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.
roundtrip questions... maybe not string... we talked
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.