-
Notifications
You must be signed in to change notification settings - Fork 925
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
Replace all usage of PyCrypto with python-cryptography #1280
Conversation
e03fd79
to
a68022d
Compare
Codecov Report
@@ Coverage Diff @@
## trunk #1280 +/- ##
==========================================
+ Coverage 85.91% 85.95% +0.03%
==========================================
Files 359 359
Lines 73777 73774 -3
Branches 6689 6690 +1
==========================================
+ Hits 63386 63411 +25
+ Misses 7719 7688 -31
- Partials 2672 2675 +3
Continue to review full report at Codecov.
|
@wrigri @Kami @tonybaloney any chance you've got some time to look over this change? |
Looks good to me. (It's been a long time since I touched this code though.) |
For what it's worth, we use |
Thank you for this contribution 👍 I'm +1 for it, because as you've said, PyCrypto in not actively maintained anymore. In the past, we had more code relying and using PyCrypto, but that's not the case anymore so the change is relatively contained and straight forward. I will look into failing tests, fix them and merge this into master. |
0161a63
to
0d113c7
Compare
0d113c7
to
c462a6f
Compare
libcloud/test/test_utils.py
Outdated
|
||
def test_pubkey_openssh_fingerprint(self): | ||
fp = get_pubkey_openssh_fingerprint(self.PUBKEY) | ||
assert fp == '35:22:13:5b:82:e2:5d:e1:90:8c:73:74:9f:ef:3b:d8' |
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 got this value from what PyCrypto code generated prior to this PR.
libcloud/test/test_utils.py
Outdated
|
||
def test_pubkey_ssh2_fingerprint(self): | ||
fp = get_pubkey_ssh2_fingerprint(self.PUBKEY) | ||
assert fp == '11:ad:5d:4c:5b:99:c9:80:7e:81:03:76:5a:25:9d:8c' |
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.
This one, too.
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.
Yeah, I think it's related to an edge case in hexadigits
utility function - I'm looking into it.
@@ -126,7 +126,7 @@ def tostring(node): | |||
|
|||
def hexadigits(s): | |||
# s needs to be a byte string. | |||
return [format(x, "x") for x in s] | |||
return [format(x, "02x") for x in s] |
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.
Ended up noticing a discrepancy between py2 and py3 here for integers 0-9
i.e.,
:3:
vs :03:
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.
This should indeed fix it and ensure leading 0
is always present.
…into gce-crypto
Merged, thanks! |
PyCrypto is dead (the last release to PyPI was in October 2013) and insecure:
pycrypto/pycrypto#173
see: https://issues.apache.org/jira/browse/LIBCLOUD-1015