-
Notifications
You must be signed in to change notification settings - Fork 89
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
openssl_pkcs12: add cryptography backend #234
openssl_pkcs12: add cryptography backend #234
Conversation
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
I have no idea why 17.1.0 was there (in the tests), and not something smaller. The module itself did not mention any version.
…or maciter_size is used.
ready_for_review |
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.
Nothing major to address. Only functional concern is handling empty passwords with cryptography
which is an edge case.
''' | ||
Load list of concatenated PEM files, and return a list of parsed certificates. | ||
''' | ||
with open(filename, 'rb') as f: | ||
data = f.read().decode('utf-8') | ||
return [load_certificate(None, content=cert) for cert in split_pem_list(data)] | ||
return [load_certificate(None, content=cert.encode('utf-8'), backend=backend) for cert in split_pem_list(data)] |
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 makes sense, but how was PyOpenSSL handling the text certificate data previously?
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.
PyOpenSSL has some magic to automatically encode: https://github.com/pyca/pyopenssl/blob/main/src/OpenSSL/crypto.py#L2898
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
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.
LGTM, with the exception of CI for 2.9 which I broke by not remembering range()
must be typecasted to list for compatibility. "{{ range(1, 4) | list }}"
should clear the failures.
@Ajpantuso thanks a lot for reviewing this! |
SUMMARY
This requires cryptography 3.0 and @Ajpantuso's hack, so we can't deprecate pyOpenSSL anytime soon.
Also this is at the moment pretty ugly, I'll have to do a lot more cleanup...
Finally,
iter_size
andmaciter_size
are not supported. Also, the cryptography docs sayPKCS12 encryption is not secure and should not be used as a security mechanism. Wrap a PKCS12 blob in a more secure envelope if you need to store or send it safely. Encryption is provided for compatibility reasons only.
.Fixes #21.
ISSUE TYPE
COMPONENT NAME
openssl_pkcs12