NEEDS REVIEW - Fix #30. Replace ctypes with cryptography (cffi). #62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #30. Replace
ctypes
withcryptography
(cffi
).There is currently one known issue:
CECKey.set_privkey
andCECKey.get_privkey
require theFFI
instance to expose thed2i_ECPrivateKey
andi2d_ECPrivateKey
functions, respectively, from the underlying OpenSSL library. Currently,cryptography
does not expose these functions. This means that those functions will not work. I have not yet investigated or considered using a hybridctypes
approach for that narrow set of functionality (if that is even possible).This only affects the
*_privkey
getter and setter. I was able to provide alternatives to theo2i_ECPublicKey
andi2o_ECPublicKey
functions used in the corresponding*_pubkey
functions (see this and this). I have not yet found (or am not clever enough to recognize) equivalents on the private key side.The reason why unit tests still pass is because the
*_privkey
getter and setter are not called from any of the tests. This is unchanged from before (I did not add tests to cover those methods).