summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2021-09-07 14:24:13 -0400
committerGitHub <noreply@github.com>2021-09-07 14:24:13 -0400
commit8e1f599eb6bb4fc129ce0519506945fb306713fa (patch)
treebfae65c152dc01fb652663a32bd7eb6c89c1885d /tests
parent30e82d4ba5e3817a77e212540477da701460e988 (diff)
downloadpyopenssl-8e1f599eb6bb4fc129ce0519506945fb306713fa.tar.gz
Fill in notBefore/notAfter in X509 _PKeyInteractionTestsMixin tests (#1039)
While the tests currently pass without it, this is because OpenSSL's encoder doesn't notice that it is emitting garbage. See https://github.com/openssl/openssl/issues/16538 Fill in a placeholder validity period so the tests both better mirror real X.509 signing code and do not rely on this bug.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_crypto.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/test_crypto.py b/tests/test_crypto.py
index 699b146..ef3429d 100644
--- a/tests/test_crypto.py
+++ b/tests/test_crypto.py
@@ -1468,7 +1468,7 @@ class _PKeyInteractionTestsMixin:
def signable(self):
"""
- Return something with a `set_pubkey`, `set_pubkey`, and `sign` method.
+ Return something with `set_pubkey` and `sign` methods.
"""
raise NotImplementedError()
@@ -1715,7 +1715,12 @@ class TestX509(_PKeyInteractionTestsMixin):
"""
Create and return a new `X509`.
"""
- return X509()
+ certificate = X509()
+ # Fill in placeholder validity values. signable only expects to call
+ # set_pubkey and sign.
+ certificate.gmtime_adj_notBefore(-24 * 60 * 60)
+ certificate.gmtime_adj_notAfter(24 * 60 * 60)
+ return certificate
def test_type(self):
"""