예제 #1
0
 def _create_general_name(self, name, inner):
     gn = rfc5280.GeneralName()
     if name == "directoryName":
         gn[name] = gn.getComponentByName(name).clone()
         gn[name]["rdnSequence"] = inner
     else:
         gn[name] = gn.getComponentByName(name).clone(inner)
     return gn
예제 #2
0
class Rand(univ.Sequence):
    """
    Rand ::= SEQUENCE {
        int      INTEGER,
        sender   GeneralName
    }
    """
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('int', univ.Integer()),
        namedtype.NamedType('sender', rfc5280.GeneralName()))
예제 #3
0
class PKIHeader(univ.Sequence):
    """
    PKIHeader ::= SEQUENCE {
        pvno                INTEGER     { cmp1999(1), cmp2000(2) },
        sender              GeneralName,
        recipient           GeneralName,
        messageTime     [0] GeneralizedTime         OPTIONAL,
        protectionAlg   [1] AlgorithmIdentifier     OPTIONAL,
        senderKID       [2] KeyIdentifier           OPTIONAL,
        recipKID        [3] KeyIdentifier           OPTIONAL,
        transactionID   [4] OCTET STRING            OPTIONAL,
        senderNonce     [5] OCTET STRING            OPTIONAL,
        recipNonce      [6] OCTET STRING            OPTIONAL,
        freeText        [7] PKIFreeText             OPTIONAL,
        generalInfo     [8] SEQUENCE SIZE (1..MAX) OF
                               InfoTypeAndValue     OPTIONAL
     }
    """
    componentType = namedtype.NamedTypes(
        namedtype.NamedType(
            'pvno',
            univ.Integer(
                namedValues=namedval.NamedValues(('cmp1999', 1), ('cmp2000',
                                                                  2)))),
        namedtype.NamedType('sender', rfc5280.GeneralName()),
        namedtype.NamedType('recipient', rfc5280.GeneralName()),
        namedtype.OptionalNamedType(
            'messageTime',
            useful.GeneralizedTime().subtype(explicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatSimple, 0))),
        namedtype.OptionalNamedType(
            'protectionAlg',
            rfc5280.AlgorithmIdentifier().subtype(explicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatConstructed, 1))),
        namedtype.OptionalNamedType(
            'senderKID',
            rfc5280.KeyIdentifier().subtype(explicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatSimple, 2))),
        namedtype.OptionalNamedType(
            'recipKID',
            rfc5280.KeyIdentifier().subtype(explicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatSimple, 3))),
        namedtype.OptionalNamedType(
            'transactionID',
            univ.OctetString().subtype(explicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatSimple, 4))),
        namedtype.OptionalNamedType(
            'senderNonce',
            univ.OctetString().subtype(explicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatSimple, 5))),
        namedtype.OptionalNamedType(
            'recipNonce',
            univ.OctetString().subtype(explicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatSimple, 6))),
        namedtype.OptionalNamedType(
            'freeText',
            PKIFreeText().subtype(explicitTag=tag.Tag(
                tag.tagClassContext, tag.tagFormatConstructed, 7))),
        namedtype.OptionalNamedType(
            'generalInfo',
            univ.SequenceOf(componentType=InfoTypeAndValue().subtype(
                sizeSpec=constraint.ValueSizeConstraint(1, MAX))).subtype(
                    explicitTag=tag.Tag(tag.tagClassContext,
                                        tag.tagFormatSimple, 8))))
예제 #4
0
            namedtype.NamedType('pendInfo', PendInfo()),
            namedtype.NamedType(
                'extendedFailInfo',
                univ.Sequence(componentType=namedtype.NamedTypes(
                    namedtype.NamedType('failInfoOID', univ.ObjectIdentifier(
                    )), namedtype.NamedType('failInfoValue',
                                            AttributeValue()))))))))


class GetCRL(univ.Sequence):
    pass


GetCRL.componentType = namedtype.NamedTypes(
    namedtype.NamedType('issuerName', rfc5280.Name()),
    namedtype.OptionalNamedType('cRLName', rfc5280.GeneralName()),
    namedtype.OptionalNamedType('time', useful.GeneralizedTime()),
    namedtype.OptionalNamedType('reasons', rfc5280.ReasonFlags()))

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
예제 #5
0
 def setUp(self):
     self.asn1Spec = rfc5280.GeneralName()
예제 #6
0
 class AccessDescription(univ.Sequence):
     componentType = namedtype.NamedTypes(
         namedtype.NamedType('accessMethod', univ.ObjectIdentifier()),
         namedtype.NamedType('accessLocation', rfc5280.GeneralName()))
예제 #7
0
id_pkip = _buildOid(id_pkix, 5)

id_regCtrl = _buildOid(id_pkip, 1)


class SinglePubInfo(univ.Sequence):
    pass


SinglePubInfo.componentType = namedtype.NamedTypes(
    namedtype.NamedType(
        'pubMethod',
        univ.Integer(namedValues=namedval.NamedValues(('dontCare', 0), (
            'x500', 1), ('web', 2), ('ldap', 3)))),
    namedtype.OptionalNamedType('pubLocation', rfc5280.GeneralName()))


class UTF8Pairs(char.UTF8String):
    pass


class PKMACValue(univ.Sequence):
    pass


PKMACValue.componentType = namedtype.NamedTypes(
    namedtype.NamedType('algId', rfc5280.AlgorithmIdentifier()),
    namedtype.NamedType('value', univ.BitString()))