示例#1
0
ObjectDigestInfo.componentType = namedtype.NamedTypes(
    namedtype.NamedType(
        'digestedObjectType',
        univ.Enumerated(namedValues=namedval.NamedValues(('publicKey', 0), (
            'publicKeyCert', 1), ('otherObjectTypes', 2)))),
    namedtype.OptionalNamedType('otherObjectTypeID', univ.ObjectIdentifier()),
    namedtype.NamedType('digestAlgorithm', rfc3280.AlgorithmIdentifier()),
    namedtype.NamedType('objectDigest', univ.BitString()))


class IssuerSerial(univ.Sequence):
    pass


IssuerSerial.componentType = namedtype.NamedTypes(
    namedtype.NamedType('issuer', rfc3280.GeneralNames()),
    namedtype.NamedType('serial', rfc3280.CertificateSerialNumber()),
    namedtype.OptionalNamedType('issuerUID', rfc3280.UniqueIdentifier()))


class TargetCert(univ.Sequence):
    pass


TargetCert.componentType = namedtype.NamedTypes(
    namedtype.NamedType('targetCertificate', IssuerSerial()),
    namedtype.OptionalNamedType('targetName', rfc3280.GeneralName()),
    namedtype.OptionalNamedType('certDigestInfo', ObjectDigestInfo()))


class Target(univ.Choice):
示例#2
0
    pass


AttributeCertificateInfoV1.componentType = namedtype.NamedTypes(
    namedtype.DefaultedNamedType('version',
                                 AttCertVersionV1().subtype(value="v1")),
    namedtype.NamedType(
        'subject',
        univ.Choice(componentType=namedtype.NamedTypes(
            namedtype.NamedType(
                'baseCertificateID',
                rfc3281.IssuerSerial().subtype(explicitTag=tag.Tag(
                    tag.tagClassContext, tag.tagFormatSimple, 0))),
            namedtype.NamedType(
                'subjectName',
                rfc3280.GeneralNames().subtype(explicitTag=tag.Tag(
                    tag.tagClassContext, tag.tagFormatSimple, 1)))))),
    namedtype.NamedType('issuer', rfc3280.GeneralNames()),
    namedtype.NamedType('signature', rfc3280.AlgorithmIdentifier()),
    namedtype.NamedType('serialNumber', rfc3280.CertificateSerialNumber()),
    namedtype.NamedType('attCertValidityPeriod',
                        rfc3281.AttCertValidityPeriod()),
    namedtype.NamedType('attributes',
                        univ.SequenceOf(componentType=rfc3280.Attribute())),
    namedtype.OptionalNamedType('issuerUniqueID', rfc3280.UniqueIdentifier()),
    namedtype.OptionalNamedType('extensions', rfc3280.Extensions()))


class AttributeCertificateV1(univ.Sequence):
    pass