From 6eeb0ef13e578d8b51ca332e43c581484ac965b2 Mon Sep 17 00:00:00 2001
From: Paul Kehrer <paul.l.kehrer@gmail.com>
Date: Sun, 11 Jun 2017 12:36:25 -1000
Subject: [PATCH 1/4] the root cert expired, make a new one (using the same
 values)

The new one lasts 20 years. If this project is still in use in 20 years
we have failed.
---
 tests/test_crypto.py | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

Index: pyOpenSSL-16.0.0/tests/test_crypto.py
===================================================================
--- pyOpenSSL-16.0.0.orig/tests/test_crypto.py
+++ pyOpenSSL-16.0.0/tests/test_crypto.py
@@ -57,7 +57,7 @@ BAD_CIPHER = "zippers"
 GOOD_DIGEST = "SHA1"
 BAD_DIGEST = "monkeys"
 
-root_cert_pem = b("""-----BEGIN CERTIFICATE-----
+old_root_cert_pem = b("""-----BEGIN CERTIFICATE-----
 MIIC7TCCAlagAwIBAgIIPQzE4MbeufQwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UE
 BhMCVVMxCzAJBgNVBAgTAklMMRAwDgYDVQQHEwdDaGljYWdvMRAwDgYDVQQKEwdU
 ZXN0aW5nMRgwFgYDVQQDEw9UZXN0aW5nIFJvb3QgQ0EwIhgPMjAwOTAzMjUxMjM2
@@ -77,6 +77,26 @@ w/njVbKMXrvc83qmTdGl3TAM0fxQIpqgcglFLveE
 -----END CERTIFICATE-----
 """)
 
+root_cert_pem = b("""-----BEGIN CERTIFICATE-----
+MIIC6TCCAlKgAwIBAgIIPQzE4MbeufQwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UE
+BhMCVVMxCzAJBgNVBAgTAklMMRAwDgYDVQQHEwdDaGljYWdvMRAwDgYDVQQKEwdU
+ZXN0aW5nMRgwFgYDVQQDEw9UZXN0aW5nIFJvb3QgQ0EwHhcNMTcwNjExMjIzMjU5
+WhcNMzcwNjA2MjIzMjU5WjBYMQswCQYDVQQGEwJVUzELMAkGA1UECBMCSUwxEDAO
+BgNVBAcTB0NoaW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WpOdIpB8KksUTCzV591Nr1wd
         ASN1 GENERALIZEDTIME even for certificates which store it as UTCTIME
         internally.
         """
-        cert = load_certificate(FILETYPE_PEM, self.pemData)
+        cert = load_certificate(FILETYPE_PEM, old_root_cert_pem)
         self.assertEqual(cert.get_notBefore(), b("20090325123658Z"))
 
     def test_get_notAfter(self):
@@ -1541,7 +1561,7 @@ WpOdIpB8KksUTCzV591Nr1wd
         ASN1 GENERALIZEDTIME even for certificates which store it as UTCTIME
         internally.
         """
-        cert = load_certificate(FILETYPE_PEM, self.pemData)
+        cert = load_certificate(FILETYPE_PEM, old_root_cert_pem)
         self.assertEqual(cert.get_notAfter(), b("20170611123658Z"))
 
     def test_gmtime_adj_notBefore_wrong_args(self):
@@ -1637,7 +1657,7 @@ WpOdIpB8KksUTCzV591Nr1wd
         :py:obj:`X509.digest` returns a string giving ":"-separated hex-encoded
         words of the digest of the certificate.
         """
-        cert = load_certificate(FILETYPE_PEM, root_cert_pem)
+        cert = load_certificate(FILETYPE_PEM, old_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
