本文整理汇总了Python中pyasn1_modules.pem.readBase64fromText函数的典型用法代码示例。如果您正苦于以下问题:Python readBase64fromText函数的具体用法?Python readBase64fromText怎么用?Python readBase64fromText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readBase64fromText函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.pem_text_unordered)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert der_encoder.encode(asn1Object) == substrate
contentType = asn1Object['contentType']
substrate = asn1Object['content']
contentInfoMap = {
(1, 2, 840, 113549, 1, 7, 1): rfc2315.Data(),
(1, 2, 840, 113549, 1, 7, 2): rfc2315.SignedData(),
(1, 2, 840, 113549, 1, 7, 3): rfc2315.EnvelopedData(),
(1, 2, 840, 113549, 1, 7, 4): rfc2315.SignedAndEnvelopedData(),
(1, 2, 840, 113549, 1, 7, 5): rfc2315.DigestedData(),
(1, 2, 840, 113549, 1, 7, 6): rfc2315.EncryptedData()
}
innerAsn1Object, rest = der_decoder.decode(
substrate, asn1Spec=contentInfoMap[contentType]
)
asn1Object['content'] = der_encoder.encode(innerAsn1Object)
substrate = pem.readBase64fromText(self.pem_text_reordered)
assert not rest
assert asn1Object.prettyPrint()
assert der_encoder.encode(asn1Object) == substrate
开发者ID:luke-chang,项目名称:gecko-1,代码行数:33,代码来源:test_rfc2315.py
示例2: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.kw_pad_alg_id_pem_text)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert asn1Object[0] == rfc5649.id_aes256_wrap_pad
assert der_encoder.encode(asn1Object) == substrate
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:7,代码来源:test_rfc5649.py
示例3: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.pem_text)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert der_encoder.encode(asn1Object) == substrate
for extn in asn1Object['tbsCertificate']['extensions']:
if extn['extnID'] == rfc3779.id_pe_ipAddrBlocks:
s = extn['extnValue']
addr_blocks, rest = der_decoder.decode(s, rfc3779.IPAddrBlocks())
assert not rest
assert addr_blocks.prettyPrint()
assert der_encoder.encode(addr_blocks) == s
if extn['extnID'] == rfc3779.id_pe_autonomousSysIds:
s = extn['extnValue']
as_ids, rest = der_decoder.decode(s, rfc3779.ASIdentifiers())
assert not rest
assert as_ids.prettyPrint()
assert der_encoder.encode(as_ids) == s
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:25,代码来源:test_rfc3779.py
示例4: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.pem_text)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert der_encoder.encode(asn1Object) == substrate
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:8,代码来源:test_rfc2560.py
示例5: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.oaep_full_pem_text)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert asn1Object[0] == rfc3560.id_RSAES_OAEP
assert der_encoder.encode(asn1Object) == substrate
assert substrate == der_encoder.encode(asn1Object)
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:8,代码来源:test_rfc3560.py
示例6: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.aes_alg_id_pem_text)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert asn1Object[0] == rfc3565.id_aes256_CBC
assert asn1Object[1].isValue
assert der_encoder.encode(asn1Object) == substrate
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:8,代码来源:test_rfc3565.py
示例7: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.key_agree_alg_id_pem_text)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert asn1Object['algorithm'] == rfc8418.dhSinglePass_stdDH_hkdf_sha384_scheme
assert asn1Object['parameters'].isValue
assert der_encoder.encode(asn1Object) == substrate
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:8,代码来源:test_rfc8418.py
示例8: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.pss_sha512_pem_text)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert asn1Object[0] == rfc4055.id_RSASSA_PSS
assert der_encoder.encode(asn1Object) == substrate
assert substrate == der_encoder.encode(asn1Object)
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:8,代码来源:test_rfc4055.py
示例9: testDerCodecDecodeOpenTypes
def testDerCodecDecodeOpenTypes(self):
substrate = pem.readBase64fromText(self.pem_text_reordered)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
assert not rest
assert asn1Object.prettyPrint()
assert der_encoder.encode(asn1Object) == substrate
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:9,代码来源:test_rfc2315.py
示例10: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.no_pub_key_pem_text)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert asn1Object['privateKeyAlgorithm']['algorithm'] == rfc8410.id_Ed25519
assert asn1Object['privateKey'].isValue
assert asn1Object['privateKey'].prettyPrint()[0:10] == "0x0420d4ee"
assert der_encoder.encode(asn1Object) == substrate
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:9,代码来源:test_rfc8410.py
示例11: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.alg_id_pem_text)
asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert asn1Object[0] == rfc8103.id_alg_AEADChaCha20Poly1305
param, rest = der_decoder.decode(asn1Object[1], rfc8103.AEADChaCha20Poly1305Nonce())
assert not rest
assert param.prettyPrint()
assert param == rfc8103.AEADChaCha20Poly1305Nonce(value='\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88')
assert der_encoder.encode(asn1Object) == substrate
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:11,代码来源:test_rfc8103.py
示例12: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.pem_text)
asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert der_encode(asn1Object) == substrate
assert asn1Object['attrType'] == rfc6019.id_aa_binarySigningTime
bintime, rest = der_decode(asn1Object['attrValues'][0], asn1Spec=rfc6019.BinaryTime())
assert bintime == 0x5cbf8654
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:12,代码来源:test_rfc6019.py
示例13: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.pem_text)
asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
assert not rest
assert asn1Object.prettyPrint()
assert der_encode(asn1Object) == substrate
assert asn1Object['contentType'] == rfc5652.id_signedData
inner, rest = der_decode(asn1Object['content'], asn1Spec=rfc5652.SignedData())
assert inner['encapContentInfo']['eContentType'] == rfc4108.id_ct_firmwarePackage
assert inner['encapContentInfo']['eContent']
found_target_hardware_identifier_attribute = False
for attr in inner['signerInfos'][0]['signedAttrs']:
if attr['attrType'] == rfc4108.id_aa_targetHardwareIDs:
found_target_hardware_identifier_attribute = True
assert found_target_hardware_identifier_attribute
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:20,代码来源:test_rfc4108.py
示例14: testDerCodec
def testDerCodec(self):
substrate = pem.readBase64fromText(self.pem_text)
layers = {
rfc5652.id_ct_contentInfo: rfc5652.ContentInfo(),
rfc5652.id_signedData: rfc5652.SignedData(),
rfc6402.id_cct_PKIData: rfc6402.PKIData()
}
getNextLayer = {
rfc5652.id_ct_contentInfo: lambda x: x['contentType'],
rfc5652.id_signedData: lambda x: x['encapContentInfo']['eContentType'],
rfc6402.id_cct_PKIData: lambda x: None
}
getNextSubstrate = {
rfc5652.id_ct_contentInfo: lambda x: x['content'],
rfc5652.id_signedData: lambda x: x['encapContentInfo']['eContent'],
rfc6402.id_cct_PKIData: lambda x: None
}
next_layer = rfc5652.id_ct_contentInfo
while next_layer:
asn1Object, rest = der_decoder.decode(
substrate, asn1Spec=layers[next_layer]
)
assert not rest
assert asn1Object.prettyPrint()
assert der_encoder.encode(asn1Object) == substrate
substrate = getNextSubstrate[next_layer](asn1Object)
next_layer = getNextLayer[next_layer](asn1Object)
开发者ID:etingof,项目名称:pyasn1-modules,代码行数:37,代码来源:test_rfc5652.py
注:本文中的pyasn1_modules.pem.readBase64fromText函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论