def testDerCodec(self):
    substrate = pem.readBase64fromText(self.pem_text)
    (asn1Object, rest) = der_decoder(substrate, asn1Spec=self.asn1Spec)
    self.assertFalse(rest)
    self.assertTrue(asn1Object.prettyPrint())
    self.assertEqual(substrate, der_encoder(asn1Object))
    found = False
    certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
    for extn in asn1Object['tbsCertificate']['extensions']:
        if (extn['extnID'] == rfc8737.id_pe_acmeIdentifier):
            self.assertTrue(extn['critical'])
            self.assertIn(extn['extnID'], certificateExtensionsMap)
            (auth, rest) = der_decoder(extn['extnValue'], asn1Spec=rfc8737.Authorization())
            self.assertFalse(rest)
            self.assertTrue(auth.prettyPrint())
            self.assertEqual(extn['extnValue'], der_encoder(auth))
            self.assertEqual(32, len(auth))
            found = True
    self.assertTrue(found)
def testDerCodec(self):
    substrate = pem.readBase64fromText(self.pem_text)
    (asn1Object, rest) = der_decoder(substrate, asn1Spec=self.asn1Spec)
    self.assertFalse(rest)
    self.assertTrue(asn1Object.prettyPrint())
    self.assertEqual(substrate, der_encoder(asn1Object))
    found = False
    certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
    for extn in asn1Object['tbsCertificate']['extensions']:
        if (extn['extnID'] == rfc8737.id_pe_acmeIdentifier):
            self.assertTrue(extn['critical'])
            self.assertIn(extn['extnID'], certificateExtensionsMap)
            (auth, rest) = der_decoder(extn['extnValue'], asn1Spec=rfc8737.Authorization())
            self.assertFalse(rest)
            self.assertTrue(auth.prettyPrint())
            self.assertEqual(extn['extnValue'], der_encoder(auth))
            self.assertEqual(32, len(auth))
            found = True
    self.assertTrue(found)