本文整理匯總了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)