/// <summary>
        ///     Encode an array of LdapModifications to ASN.1.
        /// </summary>
        /// <param name="mods">
        ///     an array of LdapModification objects.
        /// </param>
        /// <returns>
        ///     an Asn1SequenceOf object containing the modifications.
        /// </returns>
        private static Asn1SequenceOf EncodeModifications(LdapModification[] mods)
        {
            // Convert Java-API LdapModification[] to RFC2251 SEQUENCE OF SEQUENCE
            var rfcMods = new Asn1SequenceOf(mods.Length);

            for (var i = 0; i < mods.Length; i++)
            {
                var attr = mods[i].Attribute;

                // place modification attribute values in Asn1SetOf
                var vals = new Asn1SetOf(attr.Size());
                if (attr.Size() > 0)
                {
                    var attrEnum = attr.ByteValues;
                    while (attrEnum.MoveNext())
                    {
                        vals.Add(new RfcAttributeValue(attrEnum.Current));
                    }
                }

                // create SEQUENCE containing mod operation and attr type and vals
                var rfcMod = new Asn1Sequence(2);
                rfcMod.Add(new Asn1Enumerated(mods[i].Op));
                rfcMod.Add(new RfcAttributeTypeAndValues(new RfcAttributeDescription(attr.Name), vals));

                // place SEQUENCE into SEQUENCE OF
                rfcMods.Add(rfcMod);
            }

            return(rfcMods);
        }
 public AttributeList_element(
     AttributeDescription type,
     Asn1SetOf<AttributeValue> vals)
 {
     this.type = type;
     this.vals = vals;
 }
 public ModifyRequest_modifications_element_modification(
     AttributeType type,
     Asn1SetOf <AttributeValue> values)
 {
     this.type   = type;
     this.values = values;
 }
 public ModifyRequest_modifications_element_modification(
     AttributeType type,
     Asn1SetOf<AttributeValue> values)
 {
     this.type = type;
     this.values = values;
 }
 public ConferenceCreateRequest(
     ConferenceName conferenceName,
     Password convenerPassword,
     Password password,
     Asn1Boolean lockedConference,
     Asn1Boolean listedConference,
     Asn1Boolean conductibleConference,
     TerminationMethod terminationMethod,
     Asn1SetOf<Privilege> conductorPrivileges,
     Asn1SetOf<Privilege> conductedPrivileges,
     Asn1SetOf<Privilege> nonConductedPrivileges,
     TextString conferenceDescription,
     TextString callerIdentifier,
     UserData userData)
 {
     this.conferenceName = conferenceName;
     this.convenerPassword = convenerPassword;
     this.password = password;
     this.lockedConference = lockedConference;
     this.listedConference = listedConference;
     this.conductibleConference = conductibleConference;
     this.terminationMethod = terminationMethod;
     this.conductorPrivileges = conductorPrivileges;
     this.conductedPrivileges = conductedPrivileges;
     this.nonConductedPrivileges = nonConductedPrivileges;
     this.conferenceDescription = conferenceDescription;
     this.callerIdentifier = callerIdentifier;
     this.userData = userData;
 }
 public SearchResponse_entry_attributes_element(
     AttributeType type,
     Asn1SetOf <AttributeValue> values)
 {
     this.type   = type;
     this.values = values;
 }
 public AttributeTypeAndValues(
     AttributeDescription type,
     Asn1SetOf<AttributeValue> vals)
 {
     this.type = type;
     this.vals = vals;
 }
Exemple #8
0
        /// <summary> Encode an array of LdapModifications to ASN.1.
        ///
        /// </summary>
        /// <param name="mods">an array of LdapModification objects
        ///
        /// </param>
        /// <returns> an Asn1SequenceOf object containing the modifications.
        /// </returns>
        static private Asn1SequenceOf encodeModifications(LdapModification[] mods)
        {
            // Convert Java-API LdapModification[] to RFC2251 SEQUENCE OF SEQUENCE
            Asn1SequenceOf rfcMods = new Asn1SequenceOf(mods.Length);

            for (int i = 0; i < mods.Length; i++)
            {
                LdapAttribute attr = mods[i].Attribute;

                // place modification attribute values in Asn1SetOf
                Asn1SetOf vals = new Asn1SetOf(attr.size());
                if (attr.size() > 0)
                {
                    System.Collections.IEnumerator attrEnum = attr.ByteValues;
                    while (attrEnum.MoveNext())
                    {
                        vals.add(new RfcAttributeValue((sbyte[])attrEnum.Current));
                    }
                }

                // create SEQUENCE containing mod operation and attr type and vals
                Asn1Sequence rfcMod = new Asn1Sequence(2);
                rfcMod.add(new Asn1Enumerated(mods[i].Op));
                rfcMod.add(new RfcAttributeTypeAndValues(new RfcAttributeDescription(attr.Name), vals));

                // place SEQUENCE into SEQUENCE OF
                rfcMods.add(rfcMod);
            }
            return(rfcMods);
        }
 public AddRequest_attrs_element(
     AttributeType type,
     Asn1SetOf<AttributeValue> values)
 {
     this.type = type;
     this.values = values;
 }
Exemple #10
0
        private static Asn1SequenceOf EncodeModifications(LdapModification[] mods)
        {
            var rfcMods = new Asn1SequenceOf(mods.Length);

            foreach (var t in mods)
            {
                var attr = t.Attribute;

                var vals = new Asn1SetOf(attr.Size());
                if (attr.Size() > 0)
                {
                    foreach (var val in attr.ByteValueArray)
                    {
                        vals.Add(new Asn1OctetString(val));
                    }
                }

                var rfcMod = new Asn1Sequence(2);
                rfcMod.Add(new Asn1Enumerated((int)t.Op));
                rfcMod.Add(new RfcAttributeTypeAndValues(attr.Name, vals));

                rfcMods.Add(rfcMod);
            }

            return(rfcMods);
        }
 public AddRequest_attrs_element(
     AttributeType type,
     Asn1SetOf <AttributeValue> values)
 {
     this.type   = type;
     this.values = values;
 }
 public AttributeTypeAndValues(
     AttributeDescription type,
     Asn1SetOf <AttributeValue> vals)
 {
     this.type = type;
     this.vals = vals;
 }
 public ConferenceCreateRequest(
     ConferenceName conferenceName,
     Password convenerPassword,
     Password password,
     Asn1Boolean lockedConference,
     Asn1Boolean listedConference,
     Asn1Boolean conductibleConference,
     TerminationMethod terminationMethod,
     Asn1SetOf <Privilege> conductorPrivileges,
     Asn1SetOf <Privilege> conductedPrivileges,
     Asn1SetOf <Privilege> nonConductedPrivileges,
     TextString conferenceDescription,
     TextString callerIdentifier,
     UserData userData)
 {
     this.conferenceName         = conferenceName;
     this.convenerPassword       = convenerPassword;
     this.password               = password;
     this.lockedConference       = lockedConference;
     this.listedConference       = listedConference;
     this.conductibleConference  = conductibleConference;
     this.terminationMethod      = terminationMethod;
     this.conductorPrivileges    = conductorPrivileges;
     this.conductedPrivileges    = conductedPrivileges;
     this.nonConductedPrivileges = nonConductedPrivileges;
     this.conferenceDescription  = conferenceDescription;
     this.callerIdentifier       = callerIdentifier;
     this.userData               = userData;
 }
 public SearchResponse_entry_attributes_element(
     AttributeType type,
     Asn1SetOf<AttributeValue> values)
 {
     this.type = type;
     this.values = values;
 }
 public AttributeList_element(
     AttributeDescription type,
     Asn1SetOf <AttributeValue> vals)
 {
     this.type = type;
     this.vals = vals;
 }
        /// <summary>
        /// Creates a _SetOfAttributeValue instance that contains a set of values.
        /// </summary>
        /// <param name="values">The values to be added.</param>
        /// <returns>The _SetOfAttributeValue instance. If values is null, an empty set will be returned.</returns>
        private Asn1SetOf <AttributeValue> CreateAttributeValueSet(string[] values)
        {
            int length = (values != null) ? values.Length : 0;

            AttributeValue[] attributeValueArray = new AttributeValue[length];
            for (int i = 0; i < length; i++)
            {
                attributeValueArray[i] = new AttributeValue(values[i]);
            }

            Asn1SetOf <AttributeValue> valueSet = new Asn1SetOf <AttributeValue>(attributeValueArray);

            return(valueSet);
        }
Exemple #17
0
        /// <summary>
        /// Creates a _SetOfAttributeValue instance that contains a set of values.
        /// </summary>
        /// <param name="values">The values to be added.</param>
        /// <returns>The _SetOfAttributeValue instance. If values is null, an empty set will be returned.</returns>
        private Asn1SetOf <AttributeValue> CreateAttributeValueSet(string[] values)
        {
            int length = (values != null) ? values.Length : 0;

            AttributeValue[] valueArray = new AttributeValue[length];
            for (int i = 0; i < length; i++)
            {
                valueArray[i] = new AttributeValue(System.Text.Encoding.ASCII.GetBytes(values[i]));
            }

            Asn1SetOf <AttributeValue> valueSet = new Asn1SetOf <AttributeValue>(valueArray);

            return(valueSet);
        }
        /// <summary> Build the attribuite list from an LdapEntry.
        ///
        /// </summary>
        /// <param name="entry">The LdapEntry associated with this add request.
        /// </param>
        private static RfcAttributeList makeRfcAttrList(LdapEntry entry)
        {
            // convert Java-API LdapEntry to RFC2251 AttributeList
            LdapAttributeSet attrSet  = entry.getAttributeSet();
            RfcAttributeList attrList = new RfcAttributeList(attrSet.Count);
            IEnumerator      itr      = attrSet.GetEnumerator();

            while (itr.MoveNext())
            {
                LdapAttribute attr     = (LdapAttribute)itr.Current;
                Asn1SetOf     vals     = new Asn1SetOf(attr.size());
                IEnumerator   attrEnum = attr.ByteValues;
                while (attrEnum.MoveNext())
                {
                    vals.add(new RfcAttributeValue((sbyte[])attrEnum.Current));
                }
                attrList.add(new RfcAttributeTypeAndValues(new RfcAttributeDescription(attr.Name), vals));
            }
            return(attrList);
        }
        /// <summary>
        ///     Build the attribuite list from an LdapEntry.
        /// </summary>
        /// <param name="entry">
        ///     The LdapEntry associated with this add request.
        /// </param>
        private static RfcAttributeList MakeRfcAttrList(LdapEntry entry)
        {
            // convert Java-API LdapEntry to RFC2251 AttributeList
            var attrSet  = entry.GetAttributeSet();
            var attrList = new RfcAttributeList(attrSet.Count);
            var itr      = attrSet.GetEnumerator();

            while (itr.MoveNext())
            {
                var attr     = itr.Current;
                var vals     = new Asn1SetOf(attr.Size());
                var attrEnum = attr.ByteValues;
                while (attrEnum.MoveNext())
                {
                    vals.Add(new RfcAttributeValue(attrEnum.Current));
                }

                attrList.Add(new RfcAttributeTypeAndValues(new RfcAttributeDescription(attr.Name), vals));
            }

            return(attrList);
        }
        //*************************************************************************
        // Constructor for AttributeTypeAndValues
        //*************************************************************************

        /// <summary> </summary>
        public RfcAttributeTypeAndValues(RfcAttributeDescription type, Asn1SetOf vals) : base(2)
        {
            add(type);
            add(vals);
            return;
        }
 public SearchResponse_entry_attributes_element()
 {
     this.type   = null;
     this.values = null;
 }
 public AttributeList_element()
 {
     this.type = null;
     this.vals = null;
 }
 public AddRequest_attrs_element()
 {
     this.type   = null;
     this.values = null;
 }
        private Asn1SetOf<AttributeValue> CreateAttributeValueSet(byte[][] values)
        {
            int length = (values != null) ? values.Length : 0;

            AttributeValue[] valueArray = new AttributeValue[length];
            for (int i = 0; i < length; i++)
            {
                valueArray[i] = new AttributeValue(System.Text.Encoding.UTF8.GetString(values[i]));
            }

            Asn1SetOf<AttributeValue> valueSet = new Asn1SetOf<AttributeValue>(valueArray);
            return valueSet;
        }
        /// <summary>
        /// Creates a _SetOfAttributeValue instance that contains a set of values.
        /// </summary>
        /// <param name="values">The values to be added.</param>
        /// <returns>The _SetOfAttributeValue instance. If values is null, an empty set will be returned.</returns>
        private Asn1SetOf<AttributeValue> CreateAttributeValueSet(string[] values)
        {
            int length = (values != null) ? values.Length : 0;

            AttributeValue[] valueArray = new AttributeValue[length];
            for (int i = 0; i < length; i++)
            {
                valueArray[i] = new AttributeValue(values[i]);
            }

            Asn1SetOf<AttributeValue> valueSet = new Asn1SetOf<AttributeValue>(valueArray);
            return valueSet;
        }
 public AttributeTypeAndValues()
 {
     this.type = null;
     this.vals = null;
 }
 public ModifyRequest_modifications_element_modification()
 {
     this.type   = null;
     this.values = null;
 }
        public override int BerDecode(IAsn1DecodingBuffer buffer, bool explicitTag = true)
        {
            int     allLen = 0;
            Asn1Tag contextTag;

            allLen += TagBerDecode(buffer, out contextTag);

            int valueLen;

            allLen += LengthBerDecode(buffer, out valueLen);

            switch (contextTag.TagValue)
            {
            case 0:
                field0  = new Asn1SetOf <Filter>();
                allLen += field0.BerDecode(buffer, false);
                SetData(1, field0);
                break;

            case 1:
                field1  = new Asn1SetOf <Filter>();
                allLen += field1.BerDecode(buffer, false);
                SetData(2, field1);
                break;

            case 2:
                field2  = new Filter();
                allLen += field2.BerDecode(buffer, false);
                SetData(3, field2);
                break;

            case 3:
                field3  = new AttributeValueAssertion();
                allLen += field3.BerDecode(buffer, false);
                SetData(4, field3);
                break;

            case 4:
                field4  = new SubstringFilter();
                allLen += field4.BerDecode(buffer, false);
                SetData(5, field4);
                break;

            case 5:
                field5  = new AttributeValueAssertion();
                allLen += field5.BerDecode(buffer, false);
                SetData(6, field5);
                break;

            case 6:
                field6  = new AttributeValueAssertion();
                allLen += field6.BerDecode(buffer, false);
                SetData(7, field6);
                break;

            case 7:
                field7  = new AttributeDescription();
                allLen += field7.BerDecode(buffer, false);
                SetData(8, field7);
                break;

            case 8:
                field8  = new AttributeValueAssertion();
                allLen += field8.BerDecode(buffer, false);
                SetData(9, field8);
                break;

            case 9:
                field9  = new MatchingRuleAssertion();
                allLen += field9.BerDecode(buffer, false);
                SetData(10, field9);
                break;

            default:
                throw new Asn1DecodingUnexpectedData(ExceptionMessages.DecodingUnexpectedData + " AuthenticationChoice");
            }
            return(allLen);
        }