-
Notifications
You must be signed in to change notification settings - Fork 419
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
Add the ability to set a custom verification time on X509Store #567
Changes from 11 commits
6fd2adf
d60db38
2d4929b
67c9bc8
90ed8cb
85158ff
67ec91a
96f1394
0f85779
810bbe0
b0ff2ec
db8f831
a0bdd7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1518,6 +1518,21 @@ def set_flags(self, flags): | |
""" | ||
_openssl_assert(_lib.X509_STORE_set_flags(self._store, flags) != 0) | ||
|
||
def set_time(self, vfy_time): | ||
""" | ||
Set verification time to this store. | ||
|
||
.. versionadded: 16.3.0 | ||
|
||
:param datetime vfy_time: The verification time to set on this store. | ||
:return: ``None`` if the verification time was successfully set. | ||
""" | ||
param = _lib.X509_VERIFY_PARAM_new() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll need to add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your feedback! When I try: from OpenSSL._util import lib
lib.X509_VERIFY_PARAM_free I got this exception on my system: It looks like Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, you're quite right it isn't currently exported in cryptography. Please do submit a PR there! |
||
param = _ffi.gc(param, _lib.X509_VERIFY_PARAM_free) | ||
|
||
_lib.X509_VERIFY_PARAM_set_time(param, int(vfy_time.strftime('%s'))) | ||
_openssl_assert(_lib.X509_STORE_set1_param(self._store, param) != 0) | ||
|
||
|
||
X509StoreType = X509Store | ||
|
||
|
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.
Final thing: could you add a few more lines about the what that method is good for? Is that grammar even correct? Honest question. :)
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.
No problem. Not sure it was correct. It's updated.