Skip to content
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

_verify: Create a new X509Store for each verify call #174

Merged
merged 3 commits into from
Jul 28, 2022
Merged

Conversation

tetsuo-cpp
Copy link
Collaborator

Closes #173

Signed-off-by: Alex Cameron <alex.cameron@trailofbits.com>
Signed-off-by: Alex Cameron <alex.cameron@trailofbits.com>
@tetsuo-cpp
Copy link
Collaborator Author

tetsuo-cpp commented Jul 28, 2022

I think there might be an underlying issue to report to either pyopenssl or openssl itself since, if the set_time call succeeds, users would understandably expect it to use the new time. I'll figure out where I need to file a report.

In the meantime, let's just get it working again with this patch.

@woodruffw
Copy link
Member

I think there might be an underlying issue to report to either pyopenssl or openssl itself since, if the set_time call succeeds, users would understandably expect it to use the new time.

Yeah, that smells like a PyOpenSSL (or underlying OpenSSL) bug to me, or at least a documentation error.

I'd suggest filing it here: https://github.com/pyca/pyopenssl

woodruffw
woodruffw previously approved these changes Jul 28, 2022
Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

store = X509Store()
for parent_cert_pem in self._fulcio_certificate_chain:
parent_cert = load_pem_x509_certificate(parent_cert_pem)
parent_cert_ossl = X509.from_cryptography(parent_cert)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it'd probably be better to do this in the constructor and just store the parent_cert_ossls for each chain member.

Signed-off-by: Alex Cameron <alex.cameron@trailofbits.com>
@tetsuo-cpp
Copy link
Collaborator Author

Ok, I've removed the duplicate work. I'll let you take another look and pull the trigger on it.

Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM structurally. We should probably get some tests in the CI that exercise this code path, so that we don't regress here in the future.

@woodruffw woodruffw merged commit 455b50d into main Jul 28, 2022
@woodruffw woodruffw deleted the alex/x509-time branch July 28, 2022 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verifying multiple files causes certificate is not yet valid from OpenSSL
2 participants