public SASLAuthChoice()
 {
     Tag = new DERTag
     {
         PcType    = PcTypes.Primitive,
         TagClass  = ClassTags.ContextSpecific,
         TagNumber = (int)BindRequestAuthenticationChoices.SASL
     };
 }
 public AbandonRequest()
 {
     Tag = new DERTag
     {
         LdapCommand = LdapCommands.UnbindRequest,
         TagClass    = ClassTags.Application,
         TagNumber   = (int)LdapCommands.UnbindRequest,
         PcType      = PcTypes.Constructed
     };
 }
 public SearchResultDone() : base()
 {
     Tag = new DERTag
     {
         LdapCommand = LdapCommands.SearchResultDone,
         TagClass    = ClassTags.Application,
         TagNumber   = (int)LdapCommands.SearchResultDone,
         PcType      = PcTypes.Constructed
     };
 }
 public ModifyResponse() : base()
 {
     Tag = new DERTag
     {
         LdapCommand = LdapCommands.ModifyResponse,
         TagClass    = ClassTags.Application,
         TagNumber   = (int)LdapCommands.ModifyResponse,
         PcType      = PcTypes.Constructed
     };
 }
Esempio n. 5
0
 public ModifyDNRequest()
 {
     Tag = new DERTag
     {
         LdapCommand = LdapCommands.ModifyDNRequest,
         TagClass    = ClassTags.Application,
         TagNumber   = (int)LdapCommands.ModifyDNRequest,
         PcType      = PcTypes.Constructed
     };
 }
 public DEREnumerated()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Enumerated,
         TagNumber          = (int)UniversalClassTypes.Enumerated,
         PcType             = PcTypes.Primitive
     };
 }
Esempio n. 7
0
 public DERBoolean()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Boolean,
         TagNumber          = (int)UniversalClassTypes.Boolean,
         PcType             = PcTypes.Primitive
     };
 }
 public SearchResultEntry()
 {
     PartialAttributes = new DERSequence <PartialAttribute>();
     Tag = new DERTag
     {
         LdapCommand = LdapCommands.SearchResultEntry,
         TagClass    = ClassTags.Application,
         TagNumber   = (int)LdapCommands.SearchResultEntry,
         PcType      = PcTypes.Constructed
     };
 }
Esempio n. 9
0
 public DERInteger()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Integer,
         TagNumber          = (int)UniversalClassTypes.Integer,
         PcType             = PcTypes.Primitive
     };
 }
Esempio n. 10
0
 public ModifyRequestChange()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Sequence,
         TagNumber          = (int)UniversalClassTypes.Sequence,
         PcType             = PcTypes.Constructed
     };
 }
Esempio n. 11
0
 public LDAPResult()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Sequence,
         TagNumber          = (int)UniversalClassTypes.Sequence,
         PcType             = PcTypes.Constructed
     };
 }
 public DEROctetString()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.OctetString,
         TagNumber          = (int)UniversalClassTypes.OctetString,
         PcType             = PcTypes.Primitive
     };
 }
 public RealSearchControlValue()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Sequence,
         TagNumber          = (int)UniversalClassTypes.Sequence,
         PcType             = PcTypes.Constructed
     };
 }
Esempio n. 14
0
 public DERSequence()
 {
     Values = new List <T>();
     Tag    = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Sequence,
         TagNumber          = (int)UniversalClassTypes.Sequence,
         PcType             = PcTypes.Constructed
     };
 }
 public PartialAttribute()
 {
     Vals = new DERSet <DEROctetString>();
     Tag  = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Sequence,
         TagNumber          = (int)UniversalClassTypes.Sequence,
         PcType             = PcTypes.Constructed
     };
 }
 public DEROctetString(string value)
 {
     Value   = value;
     Payload = Encoding.ASCII.GetBytes(value).ToList();
     Tag     = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.OctetString,
         TagNumber          = (int)UniversalClassTypes.OctetString,
         PcType             = PcTypes.Primitive
     };
 }
        public override ICollection <byte> Serialize()
        {
            var content = new List <byte>();
            var b       = new DERTag
            {
                PcType    = PcTypes.Primitive,
                TagClass  = ClassTags.ContextSpecific,
                TagNumber = (int)Type
            }.Serialize();

            switch (Type)
            {
            case SearchRequestFilterTypes.Present:
                var payload = Encoding.ASCII.GetBytes(Value);
                content.AddRange(payload);
                break;

            case SearchRequestFilterTypes.GreaterOrEqual:
            case SearchRequestFilterTypes.LessOrEqual:
            case SearchRequestFilterTypes.ApproxMatch:
            case SearchRequestFilterTypes.EqualityMatch:
                content.AddRange(Attribute.Serialize());
                break;

            case SearchRequestFilterTypes.Or:
            case SearchRequestFilterTypes.And:
                foreach (var filter in Filters)
                {
                    content.AddRange(filter.Serialize());
                }

                break;
            }

            Length = content.Count();
            var result = new List <byte>();

            result.AddRange(SerializeDerStructure(true, b));
            result.AddRange(content);
            return(result);
        }
Esempio n. 18
0
        public static BindRequest Extract(ICollection <byte> buffer)
        {
            var result = new BindRequest();

            result.Version = DERInteger.Extract(buffer);
            result.Name    = DEROctetString.Extract(buffer);
            var cloneBuffer = buffer.ToList();
            var tag         = DERTag.Extract(cloneBuffer);
            var authMethod  = (BindRequestAuthenticationChoices)tag.TagNumber;

            switch (authMethod)
            {
            case BindRequestAuthenticationChoices.SASL:
                result.Authentication = SASLAuthChoice.Extract(buffer);
                break;

            case BindRequestAuthenticationChoices.SIMPLE:
                result.Authentication = SimpleAuthChoice.Extract(buffer);
                break;
            }

            return(result);
        }