class QCStatement(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('statementId', univ.ObjectIdentifier()),
        namedtype.OptionalNamedType('statementInfo',
                                    univ.Any(),
                                    openType=opentype.OpenType(
                                        'statementId', qcStatementMap)))
Beispiel #2
0
class EncryptionInfo(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('encryptionInfoType', univ.ObjectIdentifier()),
        namedtype.NamedType('encryptionInfoValue', univ.Any(),
            openType=opentype.OpenType('encryptionInfoType',
                ersEncryptionInfoValueMap))
    )
Beispiel #3
0
class OtherRevInfo(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('riType', univ.ObjectIdentifier()),
        namedtype.NamedType('riValue',
                            univ.Any(),
                            openType=opentype.OpenType(
                                'riType', rfc5652.otherRevInfoFormatMap)))
Beispiel #4
0
class Attribute(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('type', AttributeType()),
        namedtype.NamedType('values',
                            univ.SetOf(componentType=AttributeValue()),
                            openType=opentype.OpenType(
                                'type', certificateAttributesMap)))
Beispiel #5
0
class ValidationPolRef(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('valPolId', univ.ObjectIdentifier()),
        namedtype.OptionalNamedType('valPolParams',
                                    univ.Any(),
                                    openType=opentype.OpenType(
                                        'valPolId', scvpValidationPolMap)))
Beispiel #6
0
class Extension(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('extnID', univ.ObjectIdentifier()),
        namedtype.DefaultedNamedType('critical', univ.Boolean('False')),
        namedtype.NamedType('extnValue', univ.OctetString(),
                            openType=opentype.OpenType('extnID', certificateExtensionsMap))
    )
Beispiel #7
0
class OtherEvidence(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('oeType', univ.ObjectIdentifier()),
        namedtype.NamedType('oeValue',
                            univ.Any(),
                            openType=opentype.OpenType('oeType',
                                                       otherEvidenceMap)))
Beispiel #8
0
class GLAQueryResponse(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('glaResponseType', univ.ObjectIdentifier()),
        namedtype.NamedType('glaResponseValue',
                            univ.Any(),
                            openType=opentype.OpenType('glaResponseType',
                                                       glaQueryRRMap)))
Beispiel #9
0
class ValidationAlg(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('valAlgId', univ.ObjectIdentifier()),
        namedtype.OptionalNamedType('parameters',
                                    univ.Any(),
                                    openType=opentype.OpenType(
                                        'valPolId', scvpValidationAlgMap)))
Beispiel #10
0
class AttributeValueAssertion(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('attributeType', AttributeType()),
        namedtype.NamedType('attributeValue',
                            AttributeValue(),
                            openType=opentype.OpenType(
                                'type', certificateAttributesMap)))
Beispiel #11
0
class OtherRevVals(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('otherRevValType', OtherRevValType()),
        namedtype.NamedType('otherRevVals',
                            univ.Any(),
                            openType=opentype.OpenType('otherRevValType',
                                                       otherRevValMap)))
Beispiel #12
0
class SigPolicyQualifierInfo(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('sigPolicyQualifierId', SigPolicyQualifierId()),
        namedtype.NamedType('sigQualifier',
                            univ.Any(),
                            openType=opentype.OpenType('sigPolicyQualifierId',
                                                       sigQualifiersMap)))
Beispiel #13
0
class CommitmentTypeQualifier(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('commitmentTypeIdentifier',
             CommitmentTypeIdentifier()),
        namedtype.NamedType('qualifier', univ.Any(),
            openType=opentype.OpenType('commitmentTypeIdentifier',
                 commitmentQualifierMap))
    )
Beispiel #14
0
class PolicyQualifierInfo(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('policyQualifierId', PolicyQualifierId()),
        namedtype.NamedType(
            'qualifier', univ.Any(),
            openType=opentype.OpenType('policyQualifierId', policyQualifierInfoMap)
        )
    )
 def setUp(self):
     openType = opentype.OpenType('id', {
         1: univ.Integer(),
         2: univ.OctetString()
     })
     self.s = univ.Sequence(componentType=namedtype.NamedTypes(
         namedtype.NamedType('id', univ.Integer()),
         namedtype.NamedType('blob', univ.Any(), openType=openType)))
Beispiel #16
0
class ContentInfo(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('contentType', ContentType()),
        namedtype.OptionalNamedType(
            'content',
            univ.Any().subtype(explicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatConstructed, 0)),
            openType=opentype.OpenType('contentType', contentTypeMap)))
Beispiel #17
0
class AnotherName(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('type-id', univ.ObjectIdentifier()),
        namedtype.NamedType(
            'value',
            univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)),
            openType=opentype.OpenType('type-id', anotherNameMap)
        )
    )
Beispiel #18
0
class EncryptedContentInfo(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('contentType', ContentType()),
        namedtype.NamedType('contentEncryptionAlgorithm',
                            ContentEncryptionAlgorithmIdentifier()),
        namedtype.OptionalNamedType(
            'encryptedContent',
            EncryptedContent().subtype(implicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatConstructed, 0)),
            openType=opentype.OpenType('contentType', contentTypeMap)))
Beispiel #19
0
class SecurityCategory(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('type',
            univ.ObjectIdentifier().subtype(implicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatSimple, 0))),
        namedtype.NamedType('value',
            univ.Any().subtype(implicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatSimple, 1)),
            openType=opentype.OpenType('type', securityCategoryMap))
    )
Beispiel #20
0
class ExtensionAttribute(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType(
            'extension-attribute-type',
            univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, ub_extension_attributes)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
        namedtype.NamedType(
            'extension-attribute-value',
            univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)),
            openType=opentype.OpenType('type', certificateExtensionsMap))
    )
 def setUp(self):
     openType = opentype.OpenType('id', {
         1: univ.Integer(),
         2: univ.OctetString()
     })
     self.s = univ.Sequence(componentType=namedtype.NamedTypes(
         namedtype.NamedType('id', univ.Integer()),
         namedtype.NamedType('blob',
                             univ.Any().subtype(explicitTag=tag.Tag(
                                 tag.tagClassContext, tag.tagFormatSimple,
                                 3)),
                             openType=openType)))
Beispiel #22
0
class InfoTypeAndValue(univ.Sequence):
    """
    InfoTypeAndValue ::= SEQUENCE {
         infoType           OBJECT IDENTIFIER,
         infoValue          ANY DEFINED BY infoType   OPTIONAL
     }
    """
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('infoType', univ.ObjectIdentifier()),
        namedtype.OptionalNamedType('infoValue',
                                    univ.Any(),
                                    openType=opentype.OpenType(
                                        'infoType', infoTypeAndValueMap)))
Beispiel #23
0
    pass


SingleAttributeValues.componentType = AttributeValue()


class SingleAttribute(univ.Sequence):
    pass


SingleAttribute.componentType = namedtype.NamedTypes(
    namedtype.NamedType('type', AttributeType()),
    namedtype.NamedType('values',
                        AttributeValues().subtype(
                            sizeSpec=constraint.ValueSizeConstraint(1, 1)),
                        openType=opentype.OpenType('type',
                                                   certificateAttributesMap)))

# CMSAttribute is the same as Attribute in RFC 5652, and CMSSingleAttribute
# is the companion where the attrValues SET must have one and only one member

CMSAttribute = rfc5652.Attribute


class CMSSingleAttribute(univ.Sequence):
    pass


CMSSingleAttribute.componentType = namedtype.NamedTypes(
    namedtype.NamedType('attrType', AttributeType()),
    namedtype.NamedType('attrValues',
                        AttributeValues().subtype(
Beispiel #24
0
    pass


SingleAttributeValues.componentType = AttributeValue()


class SingleAttribute(univ.Sequence):
    pass


SingleAttribute.componentType = namedtype.NamedTypes(
    namedtype.NamedType('type', AttributeType()),
    namedtype.NamedType('values',
                        AttributeValues().subtype(
                            sizeSpec=constraint.ValueSizeConstraint(1, 1)),
                        openType=opentype.OpenType(
                            'type', rfc5280.certificateAttributesMap)))

# CMSAttribute is the same as Attribute in RFC 5652, and CMSSingleAttribute
# is the companion where the attrValues SET must have one and only one member

CMSAttribute = rfc5652.Attribute


class CMSSingleAttribute(univ.Sequence):
    pass


CMSSingleAttribute.componentType = namedtype.NamedTypes(
    namedtype.NamedType('attrType', AttributeType()),
    namedtype.NamedType('attrValues',
                        AttributeValues().subtype(
Beispiel #25
0

class AttributeValues(univ.SetOf):
    pass

AttributeValues.componentType = AttributeValue()
AttributeValues.sizeSpec = univ.Set.sizeSpec + constraint.ValueSizeConstraint(1, 1)


class SingleAttribute(univ.Sequence):
    pass

SingleAttribute.componentType = namedtype.NamedTypes(
    namedtype.NamedType('attrType', univ.ObjectIdentifier()),
    namedtype.NamedType('attrValues', AttributeValues(),
        openType=opentype.OpenType('attrType', rfc5652.cmsAttributesMap)
    )
)


# SIR Entity Name

class SIREntityNameType(univ.ObjectIdentifier):
    pass


class SIREntityNameValue(univ.Any):
    pass


class SIREntityName(univ.Sequence):
Beispiel #26
0
 class Sequence(univ.Sequence):
     componentType = namedtype.NamedTypes(
         namedtype.NamedType('id', univ.Integer()),
         namedtype.NamedType('blob',
                             self.taggedAny,
                             openType=opentype.OpenType(name='id')))
    namedtype.NamedType('signature', univ.BitString())
)


class AttributeValue(univ.Any):
    pass


class Attribute(univ.Sequence):
    pass


Attribute.componentType = namedtype.NamedTypes(
    namedtype.NamedType('attrType', univ.ObjectIdentifier()),
    namedtype.NamedType('attrValues', univ.SetOf(componentType=AttributeValue()),
        openType=opentype.OpenType('attrType', cmsAttributesMap)
    )
)


class SignedAttributes(univ.SetOf):
    pass


SignedAttributes.componentType = Attribute()
SignedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)


class AttributeCertificateV2(rfc3281.AttributeCertificate):
    pass
Beispiel #28
0
id_cmc_addExtensions = _buildOid(id_cmc, 8)

id_cmc_modCertTemplate = _buildOid(id_cmc, 31)


class TaggedAttribute(univ.Sequence):
    pass


TaggedAttribute.componentType = namedtype.NamedTypes(
    namedtype.NamedType('bodyPartID', BodyPartID()),
    namedtype.NamedType('attrType', univ.ObjectIdentifier()),
    namedtype.NamedType('attrValues',
                        univ.SetOf(componentType=AttributeValue()),
                        openType=opentype.OpenType('attrType',
                                                   cmcControlAttributesMap)))


class OtherMsg(univ.Sequence):
    pass


OtherMsg.componentType = namedtype.NamedTypes(
    namedtype.NamedType('bodyPartID', BodyPartID()),
    namedtype.NamedType('otherMsgType', univ.ObjectIdentifier()),
    namedtype.NamedType('otherMsgValue', univ.Any()))


class PKIData(univ.Sequence):
    pass
Beispiel #29
0
    pass


AttributeValues.componentType = AttributeValue()


class CMSSingleAttribute(univ.Sequence):
    pass


CMSSingleAttribute.componentType = namedtype.NamedTypes(
    namedtype.NamedType('attrType', AttributeType()),
    namedtype.NamedType('attrValues',
                        AttributeValues().subtype(
                            sizeSpec=constraint.ValueSizeConstraint(1, 1)),
                        openType=opentype.OpenType('attrType',
                                                   cmsAttributesMap)))

# Object identifier arcs

rsadsi = _OID(1, 2, 840, 113549)

pkcs = _OID(rsadsi, 1)

pkcs_9 = _OID(pkcs, 9)

certTypes = _OID(pkcs_9, 22)

crlTypes = _OID(pkcs_9, 23)

pkcs_12 = _OID(pkcs, 12)
# S/MIME Capabilities Attribute

smimeCapabilities = univ.ObjectIdentifier('1.2.840.113549.1.9.15')

smimeCapabilityMap = {}


class SMIMECapability(univ.Sequence):
    pass


SMIMECapability.componentType = namedtype.NamedTypes(
    namedtype.NamedType('capabilityID', univ.ObjectIdentifier()),
    namedtype.OptionalNamedType('parameters',
                                univ.Any(),
                                openType=opentype.OpenType(
                                    'capabilityID', smimeCapabilityMap)))


class SMIMECapabilities(univ.SequenceOf):
    pass


SMIMECapabilities.componentType = SMIMECapability()


class SMIMECapabilitiesParametersForRC2CBC(univ.Integer):
    # which carries the RC2 Key Length (number of bits)
    pass


# S/MIME Encryption Key Preference Attribute