Skip to content
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

Merged
merged 27 commits into from
Oct 19, 2023
Merged

rsa bindings #511

merged 27 commits into from
Oct 19, 2023

Conversation

DmitriyMusatkin
Copy link
Contributor

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.

awscrt/crypto.py Outdated Show resolved Hide resolved
awscrt/crypto.py Outdated Show resolved Hide resolved
awscrt/crypto.py Outdated Show resolved Hide resolved
.gitignore Show resolved Hide resolved
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:
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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

source/crypto.c Outdated Show resolved Hide resolved
source/module.c Outdated Show resolved Hide resolved
test/test_crypto.py Outdated Show resolved Hide resolved
test/test_crypto.py Outdated Show resolved Hide resolved
test/test_crypto.py Outdated Show resolved Hide resolved
Copy link
Contributor

@graebm graebm left a 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
Comment on lines 99 to 104
class RSA:
def __init__(self, native_handle):
"""
don't call me, I'm private
"""
self._rsa = native_handle
Copy link
Contributor

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:
Copy link
Contributor

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

awscrt/crypto.py Outdated Show resolved Hide resolved
awscrt/crypto.py Outdated Show resolved Hide resolved
@DmitriyMusatkin DmitriyMusatkin merged commit 00e826a into main Oct 19, 2023
63 checks passed
@DmitriyMusatkin DmitriyMusatkin deleted the rsa_bindings branch October 19, 2023 00:26
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