本文整理汇总了Python中pyasn1.type.univ.SequenceOf方法的典型用法代码示例。如果您正苦于以下问题:Python univ.SequenceOf方法的具体用法?Python univ.SequenceOf怎么用?Python univ.SequenceOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasn1.type.univ
的用法示例。
在下文中一共展示了univ.SequenceOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testExtensionsMap
# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import SequenceOf [as 别名]
def testExtensionsMap(self):
class SequenceOfOID(univ.SequenceOf):
componentType = univ.ObjectIdentifier()
openTypesMap = {
univ.ObjectIdentifier('0.4.0.1862.1.6'): SequenceOfOID()
}
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))
count = 0
found_qc_stmt_oid = False
for extn in asn1Object['tbsCertificate']['extensions']:
if extn['extnID'] == rfc3739.id_pe_qcStatements:
qc_stmts, rest = der_decoder(
extn['extnValue'],
asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']],
openTypes=openTypesMap,
decodeOpenTypes=True)
self.assertFalse(rest)
self.assertTrue(qc_stmts.prettyPrint())
self.assertEqual(extn['extnValue'], der_encoder(qc_stmts))
for qcs in qc_stmts:
count += 1
if qcs['statementId'] in openTypesMap.keys():
for oid in qcs['statementInfo']:
if oid == univ.ObjectIdentifier('0.4.0.1862.1.6.1'):
found_qc_stmt_oid = True
self.assertEqual(2, count)
self.assertTrue(found_qc_stmt_oid)