예제 #1
0
 public SASLAuthChoice()
 {
     Tag = new DERTag
     {
         PcType    = PcTypes.Primitive,
         TagClass  = ClassTags.ContextSpecific,
         TagNumber = (int)BindRequestAuthenticationChoices.SASL
     };
 }
예제 #2
0
 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
     };
 }
예제 #4
0
 public ModifyResponse() : base()
 {
     Tag = new DERTag
     {
         LdapCommand = LdapCommands.ModifyResponse,
         TagClass    = ClassTags.Application,
         TagNumber   = (int)LdapCommands.ModifyResponse,
         PcType      = PcTypes.Constructed
     };
 }
예제 #5
0
 public ModifyDNRequest()
 {
     Tag = new DERTag
     {
         LdapCommand = LdapCommands.ModifyDNRequest,
         TagClass    = ClassTags.Application,
         TagNumber   = (int)LdapCommands.ModifyDNRequest,
         PcType      = PcTypes.Constructed
     };
 }
예제 #6
0
 public DEREnumerated()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Enumerated,
         TagNumber          = (int)UniversalClassTypes.Enumerated,
         PcType             = PcTypes.Primitive
     };
 }
예제 #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
     };
 }
예제 #9
0
 public DERInteger()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Integer,
         TagNumber          = (int)UniversalClassTypes.Integer,
         PcType             = PcTypes.Primitive
     };
 }
예제 #10
0
 public ModifyRequestChange()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Sequence,
         TagNumber          = (int)UniversalClassTypes.Sequence,
         PcType             = PcTypes.Constructed
     };
 }
예제 #11
0
 public LDAPResult()
 {
     Tag = new DERTag
     {
         LdapCommand        = null,
         TagClass           = ClassTags.Universal,
         UniversalClassType = UniversalClassTypes.Sequence,
         TagNumber          = (int)UniversalClassTypes.Sequence,
         PcType             = PcTypes.Constructed
     };
 }
예제 #12
0
 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
     };
 }
예제 #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
     };
 }
예제 #16
0
 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);
        }
예제 #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);
        }