id_pkix = _buildOid(1, 3, 6, 1, 5, 5, 7) id_cmc = _buildOid(id_pkix, 7) id_cmc_batchResponses = _buildOid(id_cmc, 29) id_cmc_popLinkWitness = _buildOid(id_cmc, 23) class PopLinkWitnessV2(univ.Sequence): pass PopLinkWitnessV2.componentType = namedtype.NamedTypes( namedtype.NamedType('keyGenAlgorithm', rfc5280.AlgorithmIdentifier()), namedtype.NamedType('macAlgorithm', rfc5280.AlgorithmIdentifier()), namedtype.NamedType('witness', univ.OctetString())) id_cmc_popLinkWitnessV2 = _buildOid(id_cmc, 33) id_cmc_identityProofV2 = _buildOid(id_cmc, 34) id_cmc_revokeRequest = _buildOid(id_cmc, 17) id_cmc_recipientNonce = _buildOid(id_cmc, 7) class ControlsProcessed(univ.Sequence): pass
from pyasn1.type import namedtype from pyasn1.type import namedval from pyasn1.type import tag from pyasn1.type import univ from pyasn1_modules import rfc5280 from pyasn1_modules import rfc6170 MAX = float('inf') class HashAlgAndValue(univ.Sequence): pass HashAlgAndValue.componentType = namedtype.NamedTypes( namedtype.NamedType('hashAlg', rfc5280.AlgorithmIdentifier()), namedtype.NamedType('hashValue', univ.OctetString()) ) class LogotypeDetails(univ.Sequence): pass LogotypeDetails.componentType = namedtype.NamedTypes( namedtype.NamedType('mediaType', char.IA5String()), namedtype.NamedType('logotypeHash', univ.SequenceOf( componentType=HashAlgAndValue()).subtype( sizeSpec=constraint.ValueSizeConstraint(1, MAX))), namedtype.NamedType('logotypeURI', univ.SequenceOf( componentType=char.IA5String()).subtype( sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
# # ASN.1 source from: # https://www.rfc-editor.org/rfc/rfc8619.txt # from pyasn1.type import univ from pyasn1_modules import rfc5280 # Object Identifiers id_alg_hkdf_with_sha256 = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.28') id_alg_hkdf_with_sha384 = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.29') id_alg_hkdf_with_sha512 = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.30') # Key Derivation Algorithm Identifiers kda_hkdf_with_sha256 = rfc5280.AlgorithmIdentifier() kda_hkdf_with_sha256['algorithm'] = id_alg_hkdf_with_sha256 # kda_hkdf_with_sha256['parameters'] are absent kda_hkdf_with_sha384 = rfc5280.AlgorithmIdentifier() kda_hkdf_with_sha384['algorithm'] = id_alg_hkdf_with_sha384 # kda_hkdf_with_sha384['parameters'] are absent kda_hkdf_with_sha512 = rfc5280.AlgorithmIdentifier() kda_hkdf_with_sha512['algorithm'] = id_alg_hkdf_with_sha512 # kda_hkdf_with_sha512['parameters'] are absent
# ASN.1 source from: # https://www.rfc-editor.org/rfc/rfc6210.txt # from pyasn1.type import constraint from pyasn1.type import univ from pyasn1_modules import rfc5280 id_alg_MD5_XOR_EXPERIMENT = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.13') class MD5_XOR_EXPERIMENT(univ.OctetString): pass MD5_XOR_EXPERIMENT.subtypeSpec = constraint.ValueSizeConstraint(64, 64) mda_xor_md5_EXPERIMENT = rfc5280.AlgorithmIdentifier() mda_xor_md5_EXPERIMENT['algorithm'] = id_alg_MD5_XOR_EXPERIMENT mda_xor_md5_EXPERIMENT['parameters'] = MD5_XOR_EXPERIMENT() # Map of Algorithm Identifier OIDs to Parameters added to the # ones that are in rfc5280.py. _algorithmIdentifierMapUpdate = { id_alg_MD5_XOR_EXPERIMENT: MD5_XOR_EXPERIMENT(), } rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
def setUp(self): self.asn1Spec = rfc5280.AlgorithmIdentifier()
# # ASN.1 source from: # https://www.rfc-editor.org/rfc/rfc8708.txt from pyasn1.type import univ from pyasn1_modules import rfc5280 # Object Identifiers id_alg_hss_lms_hashsig = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.17') id_alg_mts_hashsig = id_alg_hss_lms_hashsig # Signature Algorithm Identifier sa_HSS_LMS_HashSig = rfc5280.AlgorithmIdentifier() sa_HSS_LMS_HashSig['algorithm'] = id_alg_hss_lms_hashsig # sa_HSS_LMS_HashSig['parameters'] is alway absent # Public Key class HSS_LMS_HashSig_PublicKey(univ.OctetString): pass pk_HSS_LMS_HashSig = rfc5280.SubjectPublicKeyInfo() pk_HSS_LMS_HashSig['algorithm'] = sa_HSS_LMS_HashSig # pk_HSS_LMS_HashSig['parameters'] CONTAINS a DER-encoded HSS_LMS_HashSig_PublicKey
id_RSAES_OAEP = _OID(1, 2, 840, 113549, 1, 1, 7) id_pSpecified = _OID(1, 2, 840, 113549, 1, 1, 9) id_RSASSA_PSS = _OID(1, 2, 840, 113549, 1, 1, 10) sha256WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 11) sha384WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 12) sha512WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 13) sha224WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 14) sha1Identifier = rfc5280.AlgorithmIdentifier() sha1Identifier['algorithm'] = id_sha1 sha1Identifier['parameters'] = univ.Null("") sha224Identifier = rfc5280.AlgorithmIdentifier() sha224Identifier['algorithm'] = id_sha224 sha224Identifier['parameters'] = univ.Null("") sha256Identifier = rfc5280.AlgorithmIdentifier() sha256Identifier['algorithm'] = id_sha256 sha256Identifier['parameters'] = univ.Null("") sha384Identifier = rfc5280.AlgorithmIdentifier() sha384Identifier['algorithm'] = id_sha384 sha384Identifier['parameters'] = univ.Null("")
'2.16.840.1.101.2.1.1.4') id_fortezzaWrap80 = univ.ObjectIdentifier('2.16.840.1.101.2.1.1.23') id_kEAKeyEncryptionAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.1.24') id_keyExchangeAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.1.22') class Skipjack_Parm(univ.Sequence): componentType = namedtype.NamedTypes( namedtype.NamedType('initialization-vector', univ.OctetString())) # Update the Algorithm Identifier map in rfc5280.py. _algorithmIdentifierMapUpdate = { id_fortezzaConfidentialityAlgorithm: Skipjack_Parm(), id_kEAKeyEncryptionAlgorithm: rfc5280.AlgorithmIdentifier(), } rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate) # Update the SMIMECapabilities Attribute map in rfc5751.py _smimeCapabilityMapUpdate = { id_kEAKeyEncryptionAlgorithm: rfc5280.AlgorithmIdentifier(), } rfc5751.smimeCapabilityMap.update(_smimeCapabilityMapUpdate)