-
Notifications
You must be signed in to change notification settings - Fork 446
Swap pycrypto* for pyca/cryptography #385
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
|
👍 doubleplusgood |
src/saml2/cert.py
Outdated
| """ | ||
| for tmp_cert_str in cert_chain_str_list: | ||
| valid, message = self.verify(tmp_cert_str, cert_str) | ||
| print("validated") |
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 looks strange, leftover from testing?
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.
Good catch. Thanks!
| assert not OpenSSLWrapper().certificate_not_valid_yet(cert) | ||
| return True | ||
| cert = crypto.load_certificate(crypto.FILETYPE_PEM, cert_str) | ||
| assert cert.has_expired() == 0 |
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.
assertion in production code might be optimized out.
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'm simply replacing an existing assertion. I expect @rohe already knows that about this code.
| cert_algorithm = cert.get_signature_algorithm() | ||
| if six.PY3: | ||
| cert_algorithm = cert_algorithm.decode('ascii') | ||
| cert_str = cert_str.encode('ascii') |
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 if the certificate contains umlauts e.g. "ä"? Are they encoded in a special format?
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.
cert_str is a PEM formatted string here, which is guaranteed to be ascii. The requirement for this is because load_pem_x509_certificate takes bytes, not text.
97dfc5b to
afdf5b4
Compare
pyOpenSSL is already a dependency and pyOpenSSL uses cryptography. This also reduces the complexity of the code significantly in several places (and removes the need to directly manipulate asn1). A future PR could remove pyOpenSSL entirely as all the cert behavior is supported directly by cryptography.
|
Not that my vote has any weight here, but 👍 |
|
On January 24, 2017 11:21:35 AM CST, Roland Hedberg ***@***.***> wrote:
Merged #385.
Thanks for merging!
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
pyOpenSSL is already a dependency and pyOpenSSL uses cryptography.
This also reduces the complexity of the code significantly in several
places (and removes the need to directly manipulate asn1). A future
PR could remove pyOpenSSL entirely as all the cert behavior is supported
directly by cryptography.