本文整理汇总了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
示例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
示例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
示例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
示例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)
示例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
示例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
示例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)
示例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
示例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
示例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
示例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
示例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
示例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)