Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RfcMatchingRuleAssertion"/> class.
        /// Creates a MatchingRuleAssertion.
        /// The value null may be passed for an optional value that is not used.
        /// </summary>
        /// <param name="matchingRule">Optional matching rule.</param>
        /// <param name="type">Optional attribute description.</param>
        /// <param name="matchValue">The assertion value.</param>
        /// <param name="dnAttributes">Asn1Boolean value. (default false)</param>
        public RfcMatchingRuleAssertion(
            RfcLdapString matchingRule,
            RfcLdapString type,
            Asn1OctetString matchValue,
            Asn1Boolean dnAttributes = null)
            : base(4)
        {
            if (matchingRule != null)
            {
                Add(new Asn1Tagged(new Asn1Identifier(1), matchingRule, false));
            }
            if (type != null)
            {
                Add(new Asn1Tagged(new Asn1Identifier(2), type, false));
            }

            Add(new Asn1Tagged(new Asn1Identifier(3), matchValue, false));

            // if dnAttributes if false, that is the default value and we must not
            // encode it. (See RFC 2251 5.1 number 4)
            if (dnAttributes != null && dnAttributes.BooleanValue())
            {
                Add(new Asn1Tagged(new Asn1Identifier(4), dnAttributes, false));
            }
        }
Esempio n. 2
0
        public RfcMatchingRuleAssertion(
            string matchingRule,
            string type,
            sbyte[] matchValue,
            Asn1Boolean attributes = null)
            : base(4)
        {
            if (matchingRule != null)
            {
                Add(new Asn1Tagged(new Asn1Identifier(1), new Asn1OctetString(matchingRule), false));
            }
            if (type != null)
            {
                Add(new Asn1Tagged(new Asn1Identifier(2), new Asn1OctetString(type), false));
            }

            Add(new Asn1Tagged(new Asn1Identifier(3), new Asn1OctetString(matchValue), false));

            // if dnAttributes if false, that is the default value and we must not
            // encode it. (See RFC 2251 5.1 number 4)
            if (attributes?.BooleanValue() == true)
            {
                Add(new Asn1Tagged(new Asn1Identifier(4), attributes, false));
            }
        }
 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;
 }
Esempio n. 4
0
 public MatchingRuleAssertion()
 {
     this.matchingRule = null;
     this.type         = null;
     this.matchValue   = null;
     this.dnAttributes = null;
 }
Esempio n. 5
0
        void decode(Asn1Reader asn)
        {
            asn.MoveNextAndExpectTags((Byte)Asn1Type.INTEGER);
            Version = (Int32) new Asn1Integer(asn).Value;
            asn.MoveNextAndExpectTags(48);
            RequestMessage = new TspMessageImprint(asn.GetTagRawData());
            while (asn.MoveNextCurrentLevel())
            {
                switch (asn.Tag)
                {
                case (Byte)Asn1Type.OBJECT_IDENTIFIER:
                    PolicyID = new Asn1ObjectIdentifier(asn).Value;
                    break;

                case (Byte)Asn1Type.INTEGER:
                    UseNonce = true;
                    nonce    = new Asn1Integer(asn).Value.ToByteArray();
                    break;

                case (Byte)Asn1Type.BOOLEAN:
                    RequestCertificates = new Asn1Boolean(asn).Value;
                    break;

                case 0xa0:
                    var extList = new X509ExtensionCollection();
                    extList.Decode(asn.GetTagRawData());
                    foreach (X509Extension extension in extList)
                    {
                        _extensions.Add(extension);
                    }
                    break;
                }
            }
        }
Esempio n. 6
0
 public MatchingRuleAssertion()
 {
     this.matchingRule = null;
     this.type         = null;
     this.matchValue   = null;
     this.dnAttributes = new Asn1Boolean(false);
 }
Esempio n. 7
0
 public Control(
     LDAPOID controlType,
     Asn1Boolean criticality,
     Asn1OctetString controlValue)
 {
     this.controlType  = controlType;
     this.criticality  = criticality;
     this.controlValue = controlValue;
 }
Esempio n. 8
0
 public ModifyDNRequest(
     LDAPDN entry,
     RelativeLDAPDN newrdn,
     Asn1Boolean deleteoldrdn,
     LDAPDN newSuperior)
 {
     this.entry        = entry;
     this.newrdn       = newrdn;
     this.deleteoldrdn = deleteoldrdn;
     this.newSuperior  = newSuperior;
 }
Esempio n. 9
0
        /// <summary>
        /// BER Encode an Asn1Boolean directly into the specified output stream.
        /// </summary>
        /// <param name="b">The Asn1Boolean object to encode</param>
        /// <param name="stream">The stream.</param>
        public virtual void Encode(Asn1Boolean b, Stream stream)
        {
            /* Encode the id */
            Encode(b.GetIdentifier(), stream);

            /* Encode the length */
            stream.WriteByte(0x01);

            /* Encode the boolean content*/
            stream.WriteByte((byte)(b.BooleanValue() ? (sbyte)Identity(0xff) : (sbyte)0x00));
        }
Esempio n. 10
0
        /// <summary>
        /// BER Encode an Asn1Boolean directly into the specified output stream.
        /// </summary>
        /// <param name="b">The Asn1Boolean object to encode</param>
        /// <param name="stream">The stream.</param>
        public void Encode(Asn1Boolean b, Stream stream)
        {
            // Encode the id
            Encode(b.GetIdentifier(), stream);

            // Encode the length
            stream.WriteByte(0x01);

            // Encode the boolean content
            stream.WriteByte((byte)(b.BooleanValue() ? 0xff : 0x00));
        }
 /// <summary> </summary>
 public RfcModifyDNRequest(RfcLdapDN entry, RfcRelativeLdapDN newrdn, Asn1Boolean deleteoldrdn, RfcLdapSuperDN newSuperior) : base(4)
 {
     add(entry);
     add(newrdn);
     add(deleteoldrdn);
     if (newSuperior != null)
     {
         newSuperior.setIdentifier(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 0));
         add(newSuperior);
     }
 }
Esempio n. 12
0
 public MatchingRuleAssertion(
     MatchingRuleId matchingRule,
     AttributeDescription type,
     AssertionValue matchValue,
     Asn1Boolean dnAttributes)
 {
     this.matchingRule = matchingRule;
     this.type         = type;
     this.matchValue   = matchValue;
     this.dnAttributes = dnAttributes;
 }
Esempio n. 13
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="RfcControl" /> class.
        ///     Note: criticality is only added if true, as per RFC 2251 sec 5.1 part
        ///     (4): If a value of a type is its default value, it MUST be
        ///     absent.
        /// </summary>
        /// <param name="controlType">Type of the control.</param>
        /// <param name="criticality">The criticality.</param>
        /// <param name="controlValue">The control value.</param>
        public RfcControl(string controlType, Asn1Boolean criticality = null, Asn1Object controlValue = null)
            : base(3)
        {
            Add(controlType);
            Add(criticality ?? new Asn1Boolean(false));

            if (controlValue != null)
            {
                Add(controlValue);
            }
        }
Esempio n. 14
0
 /// <summary>
 /// Note: criticality is only added if true, as per RFC 2251 sec 5.1 part
 /// (4): If a value of a type is its default value, it MUST be
 /// absent.
 /// </summary>
 public RfcControl(RfcLdapOID controlType, Asn1Boolean criticality, Asn1OctetString controlValue) : base(3)
 {
     add(controlType);
     if (criticality.booleanValue() == true)
     {
         add(criticality);
     }
     if (controlValue != null)
     {
         add(controlValue);
     }
 }
        //*************************************************************************
        // Constructors for SearchRequest
        //*************************************************************************

        /*
         *
         */
        public RfcSearchRequest(RfcLdapDN baseObject, Asn1Enumerated scope, Asn1Enumerated derefAliases,
                                Asn1Integer sizeLimit, Asn1Integer timeLimit, Asn1Boolean typesOnly, RfcFilter filter, RfcAttributeDescriptionList attributes)
            : base(8)
        {
            add(baseObject);
            add(scope);
            add(derefAliases);
            add(sizeLimit);
            add(timeLimit);
            add(typesOnly);
            add(filter);
            add(attributes);
        }
Esempio n. 16
0
 /// <summary> </summary>
 public RfcModifyDnRequest(RfcLdapDn entry, RfcRelativeLdapDn newrdn, Asn1Boolean deleteoldrdn,
                           RfcLdapDn newSuperior)
     : base(4)
 {
     Add(entry);
     Add(newrdn);
     Add(deleteoldrdn);
     if (newSuperior != null)
     {
         newSuperior.SetIdentifier(new Asn1Identifier(Asn1Identifier.Context, false, 0));
         Add(newSuperior);
     }
 }
Esempio n. 17
0
        public void WriteBoolean(string correctResultHex, bool valueToTest)
        {
            var encoded = Helpers.GetExampleBytes(correctResultHex);

            using (var ms = new MemoryStream())
            {
                var asn1Bool = new Asn1Boolean(valueToTest);

                new DerWriter(ms).Write(asn1Bool);

                var res = Enumerable.SequenceEqual(encoded, ms.ToArray());
                Assert.True(res);
            }
        }
        /// <summary>
        ///     Note: criticality is only added if true, as per RFC 2251 sec 5.1 part
        ///     (4): If a value of a type is its default value, it MUST be
        ///     absent.
        /// </summary>
        public RfcControl(RfcLdapOid controlType, Asn1Boolean criticality, Asn1OctetString controlValue)
            : base(3)
        {
            Add(controlType);
            if (criticality.BooleanValue())
            {
                Add(criticality);
            }

            if (controlValue != null)
            {
                Add(controlValue);
            }
        }
 public Connect_Initial(
     Asn1OctetString callingDomainSelector,
     Asn1OctetString calledDomainSelector,
     Asn1Boolean upwardFlag,
     DomainParameters targetParameters,
     DomainParameters minimumParameters,
     DomainParameters maximumParameters,
     Asn1OctetString userData)
 {
     this.callingDomainSelector = callingDomainSelector;
     this.calledDomainSelector  = calledDomainSelector;
     this.upwardFlag            = upwardFlag;
     this.targetParameters      = targetParameters;
     this.minimumParameters     = minimumParameters;
     this.maximumParameters     = maximumParameters;
     this.userData = userData;
 }
 public SearchRequest(
     LDAPDN baseObject,
     SearchRequest_scope scope,
     SearchRequest_derefAliases derefAliases,
     Asn1Integer sizeLimit,
     Asn1Integer timeLimit,
     Asn1Boolean attrsOnly,
     Filter filter,
     Asn1SequenceOf <AttributeType> attributes)
 {
     this.baseObject   = baseObject;
     this.scope        = scope;
     this.derefAliases = derefAliases;
     this.sizeLimit    = sizeLimit;
     this.timeLimit    = timeLimit;
     this.attrsOnly    = attrsOnly;
     this.filter       = filter;
     this.attributes   = attributes;
 }
Esempio n. 21
0
 public SearchRequest(
     LDAPDN baseObject,
     SearchRequest_scope scope,
     SearchRequest_derefAliases derefAliases,
     Asn1Integer sizeLimit,
     Asn1Integer timeLimit,
     Asn1Boolean typesOnly,
     Filter filter,
     AttributeDescriptionList attributes)
 {
     this.baseObject   = baseObject;
     this.scope        = scope;
     this.derefAliases = derefAliases;
     this.sizeLimit    = sizeLimit;
     this.timeLimit    = timeLimit;
     this.typesOnly    = typesOnly;
     this.filter       = filter;
     this.attributes   = attributes;
 }
Esempio n. 22
0
        /// <summary>
        /// Decodes the object by BER.
        /// </summary>
        /// <param name="buffer">A buffer that contains a BER encoding result.</param>
        /// <param name="explicitTag">Indicates whether the tags should be encoded explicitly. In our Test Suites, it will always be true.</param>
        /// <returns>The number of the bytes consumed in the buffer to decode this object.</returns>
        /// <exception cref="Asn1ConstraintsNotSatisfied">
        /// Thrown when the constraints are not satisfied after decoding.
        /// </exception>
        /// <exception cref="Asn1DecodingUnexpectedData">
        /// Thrown when the data in the buffer can not be properly decoded.
        /// </exception>
        /// <remarks>Override this method in a user-defined class only if the procedure is not applicable in some special scenarios.</remarks>
        public override int BerDecode(IAsn1DecodingBuffer buffer, bool explicitTag = true)
        {
            int headLen = 0, valueLen = 0;

            if (explicitTag)
            {
                Asn1Tag seqTag;
                headLen += TagBerDecode(buffer, out seqTag);
                headLen += LengthBerDecode(buffer, out valueLen);
            }

            int     valueLenDecode = 0;
            Asn1Tag valueTag;

            // Decode referral
            valueLenDecode   += TagBerDecode(buffer, out valueTag);
            this.matchingRule = new MatchingRuleId();
            valueLenDecode   += this.matchingRule.BerDecodeWithoutUnisersalTag(buffer);

            // Decode type
            valueLenDecode += TagBerDecode(buffer, out valueTag);
            this.type       = new AttributeDescription();
            valueLenDecode += this.type.BerDecodeWithoutUnisersalTag(buffer);

            // Decode matchValue
            valueLenDecode += TagBerDecode(buffer, out valueTag);
            this.matchValue = new AssertionValue();
            valueLenDecode += this.matchValue.BerDecodeWithoutUnisersalTag(buffer);

            // Decode dnAttributes
            valueLenDecode   += TagBerDecode(buffer, out valueTag);
            this.dnAttributes = new Asn1Boolean();
            valueLenDecode   += this.dnAttributes.BerDecodeWithoutUnisersalTag(buffer);

            if (!VerifyConstraints())
            {
                throw new Asn1ConstraintsNotSatisfied(ExceptionMessages.ConstraintsNotSatisfied
                                                      + " Decode " + this.GetType().Name + ".");
            }

            return(headLen + valueLen);
        }
Esempio n. 23
0
        /// <summary>
        ///     Creates a MatchingRuleAssertion.
        ///     The value null may be passed for an optional value that is not used.
        /// </summary>
        /// <param name="matchValue">
        ///     The assertion value.
        /// </param>
        /// <param name="matchingRule">
        ///     Optional matching rule.
        /// </param>
        /// <param name="type">
        ///     Optional attribute description.
        /// </param>
        /// <param name="dnAttributes">
        ///     Asn1Boolean value. (default false)
        /// </param>
        public RfcMatchingRuleAssertion(RfcMatchingRuleId matchingRule, RfcAttributeDescription type,
                                        RfcAssertionValue matchValue, Asn1Boolean dnAttributes) : base(4)
        {
            if (matchingRule != null)
            {
                add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 1), matchingRule, false));
            }

            if (type != null)
            {
                add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 2), type, false));
            }

            add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 3), matchValue, false));

            // if dnAttributes if false, that is the default value and we must not
            // encode it. (See RFC 2251 5.1 number 4)
            if (dnAttributes != null && dnAttributes.booleanValue())
            {
                add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 4), dnAttributes, false));
            }
        }
Esempio n. 24
0
        void decodeOptionalFields(Asn1Reader asn)
        {
            while (asn.MoveNextCurrentLevel())
            {
                switch (asn.Tag)
                {
                case (Byte)Asn1Type.BOOLEAN:
                    Ordering = new Asn1Boolean(asn).Value;
                    break;

                case (Byte)Asn1Type.INTEGER:
                    NonceReceived = true;
                    nonce         = asn.GetPayload();
                    break;

                case 48:
                    break;

                case 0xa0:
                    Byte[] nameBytes = asn.GetTagRawData();
                    nameBytes[0] = 48;
                    _tsaName.Decode(nameBytes);
                    break;

                case 0xa1:
                    Byte[] extBytes = asn.GetTagRawData();
                    extBytes[0] = 48;
                    var extList = new X509ExtensionCollection();
                    extList.Decode(asn.GetTagRawData());
                    foreach (X509Extension extension in extList)
                    {
                        _extensions.Add(extension);
                    }
                    break;
                }
            }
        }
Esempio n. 25
0
 public RequireSortIndexHintValue(
     Asn1Boolean IndexOnly)
 {
     this.IndexOnly = IndexOnly;
 }
Esempio n. 26
0
 /// <summary> </summary>
 public RfcControl(RfcLdapOID controlType, Asn1Boolean criticality) : this(controlType, criticality, null)
 {
 }
Esempio n. 27
0
 public RequireSortIndexHintValue()
 {
     this.IndexOnly = null;
 }
        //*************************************************************************
        // Constructors for ModifyDNRequest
        //*************************************************************************

        /// <summary> </summary>
        public RfcModifyDNRequest(RfcLdapDN entry, RfcRelativeLdapDN newrdn, Asn1Boolean deleteoldrdn) : this(entry, newrdn, deleteoldrdn, null)
        {
        }
 public KERB_PA_PAC_REQUEST()
 {
     this.include_pac = null;
 }
 public KERB_PA_PAC_REQUEST(
     Asn1Boolean param0)
 {
     this.include_pac = param0;
 }