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6GIMDMvpz97EY1Zr7fTzYKDPAeF0vaYM5e98Rf0J5OB
+9NVMxaeylc81u4WBCLy4H3lwixB2cPbs0UCC/Pt/hXKlWukkFjGFm0xspu62IRDv
+uyEkJXhcryrBVN1WEXNCRwfFEqO+Og4/L+hh9ZyNchbfIJdjenytA1HS9jHpB/C0
+x32eHCunC2Uf7/rSWHtRAaKf67wNcM3TO25cnoWYfitZ8dj0LgMVCpZQMbwk8qYW
+gwIDAQAB
-----END PUBLIC KEY-----
"""
digicert_cert="""digicert.crt
self.assertEqual(len(c.subject),5)
def test_issuer(self):
c=X509(self.cert1)
- self.assertEqual(unicode(c.issuer),u'C=RU,ST=Москва,O=Удостоверяющий центр,CN=Виктор Вагнер,emailAddress=vitus@wagner.pp.ru')
+ self.assertEqual(unicode(c.issuer),u'O=Удостоверяющий центр,CN=Виктор Вагнер,C=RU,ST=Москва')
def test_subjectfields(self):
c=X509(self.cert1)
self.assertEqual(c.subject[Oid("C")],"RU")
x=c.subject[-1]
def test_notBefore(self):
c=X509(self.cert1)
- self.assertEqual(c.startDate,datetime.datetime(2014,10,26,19,07,17,0,utc))
+ self.assertEqual(c.startDate,datetime.datetime(2018,4,29,12,38,6,0,utc))
def test_notAfter(self):
c=X509(self.cert1)
- self.assertEqual(c.endDate,datetime.datetime(2024,10,23,19,7,17,0,utc))
+ self.assertEqual(c.endDate,datetime.datetime(2028,4,26,12,38,6,0,utc))
def test_subjectHash(self):
c=X509(self.cert1)
self.assertEqual(hash(c.subject),0x1f3ed722)
def test_issuerHash(self):
c=X509(self.cert1)
- self.assertEqual(hash(c.issuer),0x7d3ea8c3)
+ self.assertEqual(hash(c.issuer),0x55224769)
def test_namecomp(self):
c=X509(self.cert1)
ca=X509(self.ca_cert)
self.assertEqual(ca.issuer,ca.subject)
def test_serial(self):
c=X509(self.cert1)
- self.assertEqual(c.serial,0xDF448E69DADC927CL)
+ self.assertEqual(c.serial,0xf941addf6362d979L)
def test_version(self):
c=X509(self.cert1)
self.assertEqual(c.version,3)
def test_extension_outofrange(self):
cert=X509(self.cert1)
with self.assertRaises(IndexError):
- cert.extensions[4]
+ cert.extensions[8]
with self.assertRaises(IndexError):
cert.extensions[-1]
def test_extension_oid(self):