-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Align cryptography.hazmat.primitives.serialization.pkcs7.serialize_certificates
ASN.1 structure to openssl crl2pkcs7 -nocrl -certfile ...
#11123
Conversation
Can you explain the motivation for this? I believe we wrote this to match our previous behavior, when we used OpenSSL. Is it possible different OpenSSL versions have different behavior? FWIW the RFC indicates:
So it seems that |
@alex Yes I agree that both ASN.1 structures should be supported by consumers, I am dealing with a case in which that is not the case and a client of EST test server is rejecting pkcs7 data with this structure. I noticed that |
The fact that we have existing tests that make assertions about the exact PKCS7 structure indicates to me that a) OpenSSL used to emit the same ASN.1 structure we do (since our PKCS7 impl used to use OpenSSL), so I'd like to understand when that changed, or if the CLI and C API are inconsistent, b) that there may be a compatibility hazard in making this change. The RFC indicates that None is the preferred form, so I have a preference for that, but we need to understand what the implications are. |
@alex Here's what I found so let me know if I should spend time fixing the tests. a) I believe this function in cryptography is most similar to Running This is where they set the content_type to "data" in the CLI, leaving everything else as NULL references and the blame indicated this hasn't changed in 26 years https://github.com/openssl/openssl/blob/2f0b4974dfbd9bc71e1164e0742fc7fdb2b2b70e/apps/crl2pkcs7.c#L132 All other PKCS7 files without https://github.com/openssl/openssl/blob/master/test/pkcs7.pem https://github.com/openssl/openssl/blob/master/test/recipes/90-test_sslapi_data/dhparams.pem b) I don't think there'd be a compatibility hazard since consumers are supposed to handle both and this is the preferred structure per RFC and seemingly OpenSSL Let me know what you think, thanks! |
Diving into how we used to implement this (see 9da9af7), the reason for this behavior is (as far as I can tell):
And so that's why we had the previous behavior. As for whether we should change it: it sounds like OpenSSL will happily emit things in either form, so its likely most users will accept things in either form. I'd like to hear @reaperhulk's thoughts, but prima facie this seems worth doing, which means we'll need to get these tests passing. |
I also spelunked the history a bit and have the same conclusions. Seems like it's fine to change this, although I'm sure we'll find some new exciting edge case after the next release 😄 |
The fact that OpenSSL is capable of producing both of them gives me some
confidence that clients will support both.
…On Sat, Jun 22, 2024 at 10:34 AM Paul Kehrer ***@***.***> wrote:
I also spelunked the history a bit and have the same conclusions. Seems
like it's fine to change this, although I'm sure we'll find some new
exciting edge case after the next release 😄
—
Reply to this email directly, view it on GitHub
<#11123 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAGBGY6GAJQ5MVFTYOGPDZIWDPXAVCNFSM6AAAAABJSKAR7GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBUGA2TKMZVHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
All that is necessary for evil to succeed is for good people to do nothing.
|
@alex @reaperhulk Thanks for the extra investigations for the different PKCS7 structure outputs, I have replaced the DER/PEM test vectors with the |
Thanks |
This change makes the pkcs7 output more agreeable with certain tools that expect similar ASN.1 structure to openssl outputs.