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

Compatibility for OpenSSL >= 1.0.1i #193

Merged
merged 3 commits into from
Apr 15, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions OpenSSL/test/test_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -1562,19 +1562,29 @@ def test_has_not_expired(self):
cert.gmtime_adj_notAfter(2)
self.assertFalse(cert.has_expired())

def test_root_has_not_expired(self):
"""
:py:obj:`X509Type.has_expired` returns :py:obj:`False` if the certificate's not-after
time is in the future.
"""
cert = load_certificate(FILETYPE_PEM, root_cert_pem)
self.assertFalse(cert.has_expired())


def test_digest(self):
"""
:py:obj:`X509.digest` returns a string giving ":"-separated hex-encoded words
of the digest of the certificate.
"""
cert = X509()
cert = load_certificate(FILETYPE_PEM, root_cert_pem)
self.assertEqual(
# This is MD5 instead of GOOD_DIGEST because the digest algorithm
# actually matters to the assertion (ie, another arbitrary, good
# digest will not product the same digest).
# Digest verified with the command:
# openssl x509 -in root_cert.pem -noout -fingerprint -md5
cert.digest("MD5"),
b("A8:EB:07:F8:53:25:0A:F2:56:05:C5:A5:C4:C4:C7:15"))
b("19:B3:05:26:2B:F8:F2:FF:0B:8F:21:07:A8:28:B8:75"))


def _extcert(self, pkey, extensions):
Expand All @@ -1587,6 +1597,7 @@ def _extcert(self, pkey, extensions):
cert.set_notAfter(when)

cert.add_extensions(extensions)
cert.sign(pkey, 'sha1')
return load_certificate(
FILETYPE_PEM, dump_certificate(FILETYPE_PEM, cert))

Expand Down