1# 2# This file is part of pyasn1-modules software. 3# 4# Created by Russ Housley 5# Copyright (c) 2019, Vigil Security, LLC 6# License: http://snmplabs.com/pyasn1/license.html 7# 8 9import sys 10 11from pyasn1.codec.der.decoder import decode as der_decode 12from pyasn1.codec.der.encoder import encode as der_encode 13 14from pyasn1_modules import pem 15from pyasn1_modules import rfc5652 16from pyasn1_modules import rfc8358 17 18try: 19 import unittest2 as unittest 20except ImportError: 21 import unittest 22 23 24class P7STestCase(unittest.TestCase): 25 pem_text_list = ( 26"""\ 27MIIJWgYJKoZIhvcNAQcCoIIJSzCCCUcCAQMxDTALBglghkgBZQMEAgEwDQYLKoZIhvcNAQkQ 28ARugggZ0MIIGcDCCBVigAwIBAgIRANa58hQvZ26svTWQaGtqo/YwDQYJKoZIhvcNAQELBQAw 29gZcxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcT 30B1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMT0wOwYDVQQDEzRDT01PRE8g 31UlNBIENsaWVudCBBdXRoZW50aWNhdGlvbiBhbmQgU2VjdXJlIEVtYWlsIENBMB4XDTE1MDIx 32MjAwMDAwMFoXDTIwMDIxMjIzNTk1OVowgZUxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhWaXJn 33aW5pYTEPMA0GA1UEBxMGUmVzdG9uMRMwEQYDVQQKEwpJRVRGIFRydXN0MRkwFwYDVQQLExBT 34ZWNyZXRhcmlhdCBXZXN0MQ0wCwYDVQQDEwRJRVRGMSMwIQYJKoZIhvcNAQkBFhRpZXRmLWFj 35dGlvbkBpZXRmLm9yZzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMUkKtMPP1RA 36FU6sxMezYJKCt4rw30RDieB8/P67TMhA6j8Um4a2Xo+CP9Ce1oMri2bwaaQPYWB4ciEL32za 370NUE0B0iCjZZl36hon6wW6mJw1NGD/AFxnKWzhkS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sqO+O2f7rjWUJmi8/uJKD7cFDiW 158uKkPMgvqyIMnnC3ya/sC1vU+0Feqr5JcIMs2AHQeNVe8hzN4T9Pthyax7gqbxTkg3Gyt7Mwy 159WLZeK84oJmkl9ANeVgzq+P/cmqUaqtfkBFDSxaTag/eoYM3QfHNisr/jHCazqCh88VMgwhvk 160cl6NS9hdH+aOWqQ3FE1c7VJNoQRDT7ztyKCrRJFPc4wZL8tsGkKp1lP4WcaStcbUJ65AdWPb 1613CZonLY4UOBotAUpG/PObMCmWBEpr8MN0Q+kuEO2oAe9kBoFsv7MtNfyHE4CuOANRqGLRgOL 16272hN8Cy0sGWYUy+2chH3i50cT8XkDV5Rz2Z5xW3SfyAuW53j2WKLFsKkZjfkZBopSJM20V4E 1638pPnQQ/ByFwYPyS/xJZc24vsRxgogbrf11JU8hKVkfSsq3JXxUxe5w+Sh1XGTmO5tXDKFfyi 164S+VljWVifzXaR3pmTEQPhXH4nBa4K/HYytxofDP3EMli+imil2fFBbBedZkb5CIQ/Ly3soHZ 165dZlmZDkyeXJLpkNjRAsG6V82raZd9g== 166""", 167) 168 169 def setUp(self): 170 self.asn1Spec = rfc5652.ContentInfo() 171 172 def testDerCodec(self): 173 oids = [ ] 174 for pem_text in self.pem_text_list: 175 substrate = pem.readBase64fromText(pem_text) 176 asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec) 177 assert not rest 178 assert asn1Object.prettyPrint() 179 assert der_encode(asn1Object) == substrate 180 181 assert asn1Object['contentType'] == rfc5652.id_signedData 182 sd, rest = der_decode(asn1Object['content'], asn1Spec=rfc5652.SignedData()) 183 assert not rest 184 assert sd.prettyPrint() 185 assert der_encode(sd) == asn1Object['content'] 186 187 oids.append(sd['encapContentInfo']['eContentType']) 188 189 assert rfc8358.id_ct_asciiTextWithCRLF in oids 190 assert rfc8358.id_ct_pdf in oids 191 assert rfc8358.id_ct_xml in oids 192 193 194suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__]) 195 196if __name__ == '__main__': 197 import sys 198 199 result = unittest.TextTestRunner(verbosity=2).run(suite) 200 sys.exit(not result.wasSuccessful()) 201