class ThresholdFingerprintContents(Sequence): componentType = NamedTypes( NamedType( 'threshold', Integer().subtype( subtypeSpec=ValueRangeConstraint(1, 65535)).subtype( implicitTag=Tag(tagClassContext, tagFormatSimple, 0))), NamedType( 'subconditions', SetOf(componentType=Condition()).subtype( implicitTag=Tag(tagClassContext, tagFormatSimple, 1))), )
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))), )
class PrefixFingerprintContents(Sequence): componentType = NamedTypes( NamedType( 'prefix', OctetString().subtype( implicitTag=Tag(tagClassContext, tagFormatSimple, 0))), NamedType( 'maxMessageLength', Integer().subtype( subtypeSpec=ValueRangeConstraint(0, 4294967295)).subtype( implicitTag=Tag(tagClassContext, tagFormatSimple, 1))), NamedType( 'subcondition', Condition().subtype( implicitTag=Tag(tagClassContext, tagFormatConstructed, 2))), )
# IMPLICIT TAGS # EXTENSIBILITY IMPLIED 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
# You should have received a copy of the GNU Lesser General Public License # along with ldap3 in the COPYING and COPYING.LESSER files. # If not, see <http://www.gnu.org/licenses/>. from pyasn1.type.univ import OctetString, Integer, Sequence from pyasn1.type.namedtype import NamedTypes, NamedType from pyasn1.type.constraint import ValueRangeConstraint from .controls import build_control # constants # maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- MAXINT = Integer(2147483647) # constraints rangeInt0ToMaxConstraint = ValueRangeConstraint(0, MAXINT) class Integer0ToMax(Integer): subtypeSpec = Integer.subtypeSpec + rangeInt0ToMaxConstraint class Size(Integer0ToMax): # Size INTEGER (0..maxInt) pass class Cookie(OctetString): # cookie OCTET STRING pass
class IntegerPositive(Integer): subtypeSpec = Integer.subtypeSpec + ValueRangeConstraint(0, MAXINT)
class Integer7Bit(Integer): # INTEGER (1 .. 127) subtypeSpec = ValueRangeConstraint(1, 127)
NamedType('subfulfillments', univ.Any()), NamedType('subconditions', univ.SetOf( componentType=Condition() ).subtype(implicitTag=Tag(tagClassContext, tagFormatSimple, 1))) ) PrefixFulfillment.componentType = NamedTypes( NamedType( 'prefix', univ.OctetString().subtype( implicitTag=Tag(tagClassContext, tagFormatSimple, 0))), NamedType( 'maxMessageLength', univ.Integer().subtype( subtypeSpec=ValueRangeConstraint(0, 4294967295) ).subtype(implicitTag=Tag(tagClassContext, tagFormatSimple, 1))), NamedType('subfulfillment', univ.Any()), ) Fulfillment.componentType = NamedTypes( NamedType( 'preimageSha256', PreimageFulfillment().subtype( implicitTag=Tag(tagClassContext, tagFormatConstructed, 0))), NamedType( 'prefixSha256', PrefixFulfillment().subtype( implicitTag=Tag(tagClassContext, tagFormatConstructed, 1))), NamedType(
class RestrictiveASN1Model(Integer): subtypeSpec = ValueRangeConstraint(100, 199)