Пример #1
0
class Ed25519FingerprintContents(Sequence):
    componentType = NamedTypes(
        NamedType(
            'publicKey',
            OctetString().subtype(
                subtypeSpec=ValueSizeConstraint(32, 32)).subtype(
                    implicitTag=Tag(tagClassContext, tagFormatSimple, 0))), )
Пример #2
0
class SearchResultReference(SequenceOf):
    """
        SearchResultReference ::= [APPLICATION 19] SEQUENCE
                                  SIZE (1..MAX) OF uri URI

    """
    tagSet = SequenceOf.tagSet.tagImplicitly(
        Tag(tagClassApplication, tagFormatConstructed, 19))
    componentType = URI()
    subtypeSpec = SequenceOf.subtypeSpec + ValueSizeConstraint(1, MAXINT)
Пример #3
0
class SubStrings(SequenceOf):
    """
         substrings     SEQUENCE SIZE (1..MAX) OF substring CHOICE {
              initial [0] AssertionValue,  -- can occur at most once
              any     [1] AssertionValue,
              final   [2] AssertionValue } -- can occur at most once
         }
    """
    componentType = SubString()
    subtypeSpec = SequenceOf.subtypeSpec + ValueSizeConstraint(1, MAXINT)
Пример #4
0
class SimpleSha256Condition(Sequence):
    componentType = NamedTypes(
        NamedType(
            'fingerprint',
            OctetString().subtype(
                subtypeSpec=ValueSizeConstraint(32, 32)).subtype(
                    implicitTag=Tag(tagClassContext, tagFormatSimple, 0))),
        NamedType(
            'cost',
            Integer().subtype(
                subtypeSpec=ValueRangeConstraint(0, 4294967295)).subtype(
                    implicitTag=Tag(tagClassContext, tagFormatSimple, 1))),
    )
from pyasn1.type.univ import OctetString, Integer, Sequence, Choice, SequenceOf, Boolean, Null, Enumerated, SetOf
from pyasn1.type.namedtype import NamedTypes, NamedType, OptionalNamedType, DefaultedNamedType
from pyasn1.type.constraint import ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint
from pyasn1.type.namedval import NamedValues
from pyasn1.type.tag import tagClassApplication, tagFormatConstructed, Tag, tagClassContext, tagFormatSimple

# constants
# maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
LDAP_MAX_INT = 2147483647
MAXINT = Integer(LDAP_MAX_INT)

# constraints
rangeInt0ToMaxConstraint = ValueRangeConstraint(0, MAXINT)
rangeInt1To127Constraint = ValueRangeConstraint(1, 127)
size1ToMaxConstraint = ValueSizeConstraint(1, MAXINT)
responseValueConstraint = SingleValueConstraint(
    0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 32,
    33, 34, 36, 48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 71, 80,
    113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 4096)

# custom constraints
numericOIDConstraint = None  # TODO
distinguishedNameConstraint = None  # TODO
nameComponentConstraint = None  # TODO
attributeDescriptionConstraint = None  # TODO
uriConstraint = None  # TODO
attributeSelectorConstraint = None  # TODO


class Integer0ToMax(Integer):
Пример #6
0
class Or(SetOf):
    # or              [1] SET SIZE (1..MAX) OF filter Filter
    tagSet = SetOf.tagSet.tagImplicitly(
        Tag(tagClassContext, tagFormatConstructed, 1))
    subtypeSpec = SetOf.subtypeSpec + ValueSizeConstraint(1, MAXINT)
Пример #7
0
from .condition import Condition


class Ed25519Sha512Fulfillment(Sequence):

    # TODO implement
    def __deepcopy__(self, memo):
        return None


Ed25519Sha512Fulfillment.componentType = NamedTypes(
    NamedType(
        'publicKey',
        OctetString().subtype(
            subtypeSpec=ValueSizeConstraint(32, 32)).subtype(
                implicitTag=Tag(tagClassContext, tagFormatSimple, 0)),
    ),
    NamedType(
        'signature',
        OctetString().subtype(
            subtypeSpec=ValueSizeConstraint(64, 64)).subtype(
                implicitTag=Tag(tagClassContext, tagFormatSimple, 1)),
    ),
)

class ZenroomSha512Fulfillment(Sequence):

    # TODO implement
    def __deepcopy__(self, memo):
        return None
Пример #8
0
                             tagFormatSimple)

from .condition import Condition


class Ed25519Sha512Fulfillment(Sequence):

    # TODO implement
    def __deepcopy__(self, memo):
        return None


Ed25519Sha512Fulfillment.componentType = NamedTypes(
    NamedType(
        'publicKey',
        OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).subtype(
            implicitTag=Tag(tagClassContext, tagFormatSimple, 0)),
    ),
    NamedType(
        'signature',
        OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).subtype(
            implicitTag=Tag(tagClassContext, tagFormatSimple, 1)),
    ),
)


class RsaSha256Fulfillment(Sequence):
    pass


RsaSha256Fulfillment.componentType = NamedTypes(
Пример #9
0
 class GeneralNames(SequenceOf):
     # pylint: disable=C0111,R0903
     componentType = GeneralName()
     sizeSpec = SequenceOf.sizeSpec + ValueSizeConstraint(1, MAX)