-
Notifications
You must be signed in to change notification settings - Fork 27
Consistency between encryption library and RFC [depends on #193] #199
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
5a0c19c
to
3fd1305
Compare
3fd1305
to
2bffe03
Compare
pyClient/zeth/encryption.py
Outdated
# cleared, and bit 6 of the last byte set. This happens at key generation | ||
# time. See: | ||
# | ||
# https://github.com/openssl/openssl/blob/be9d82bb35812ac65cd92316d1ae7c7c75efe9cf/crypto/ec/ecx_meth.c#L81 |
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.
Note, the execution path through the code is very difficult to follow. To be sure, I've also experimentally verified that keys are generated with the expectd properties.
50e3a68
to
a5a998e
Compare
pyClient/zeth/encryption.py
Outdated
# RFC 8439, 2018, | ||
# <https://tools.ietf.org/html/rfc8439> | ||
|
||
# This implementation makes use of the `cryptography` library with OpenSSL |
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 double checking on that @dtebbs
Can we change this comment to a module-level docstring in order to add the explanations below to the module documentation?
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.
Moved to docstring
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
Also tidied some other things in that file (specifically some duplicated functionality). Let me know if you prefer that split into another PR. |
@@ -217,3 +234,23 @@ def decrypt( | |||
message = decryptor.update(ct_sym) | |||
|
|||
return message | |||
|
|||
|
|||
def _exchange(sk: EncryptionSecretKey, pk: EncryptionPublicKey) -> 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.
What does _
mean? Does it mean "internal function"?
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.
(Same question for the _
prefix used for the constants in the tests)
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.
Yes, exactly. The linters will complain if another module tries to use it, and I think they also use this to check for unused functions.
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.
I see, thanks
pyClient/zeth/encryption.py
Outdated
encrypted with a different public key. | ||
|
||
This implementation makes use of the `cryptography` library with OpenSSL | ||
nnbackend. For the avoidance of doubt, the implementation adheres to the |
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.
nnbackend
-> backend
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. Fixed.
bc05e58
to
e4df1bc
Compare
Verified that the code is consistent with the relevant RFC. Added comments explaining this with links to code.