コード例 #1
0
 public SaslCredentials(
     LDAPString mechanism,
     Asn1OctetString credentials)
 {
     this.mechanism   = mechanism;
     this.credentials = credentials;
 }
コード例 #2
0
 public SaslCredentials(
     LDAPString mechanism,
     Asn1OctetString credentials)
 {
     this.mechanism = mechanism;
     this.credentials = credentials;
 }
コード例 #3
0
        public override int BerDecode(IAsn1DecodingBuffer buffer, bool explicitTag = true)
        {
            int     headLen = 0;
            Asn1Tag seqTag;

            headLen += TagBerDecode(buffer, out seqTag);
            int valueLen;

            headLen += LengthBerDecode(buffer, out valueLen);

            int valueLenDecode = 0;

            resultCode      = new LDAPResult_resultCode();
            valueLenDecode += resultCode.BerDecode(buffer);
            matchedDN       = new LDAPDN();
            valueLenDecode += matchedDN.BerDecode(buffer);
            errorMessage    = new LDAPString();
            valueLenDecode += errorMessage.BerDecode(buffer);
            if (valueLenDecode == valueLen)
            {
                referral = null;
            }
            else
            {
                Asn1Tag contextTag;
                valueLenDecode += TagBerDecode(buffer, out contextTag);
                referral        = new Referral();
                valueLenDecode += referral.BerDecodeWithoutUnisersalTag(buffer);
            }
            if (valueLen != valueLenDecode)
            {
                throw new Asn1DecodingUnexpectedData(ExceptionMessages.DecodingUnexpectedData + " LDAPResult.");
            }
            return(headLen + valueLen);
        }
コード例 #4
0
 public ModifyResponse(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral) : base(resultCode, matchedDN, errorMessage, referral)
 {
 }
コード例 #5
0
        public override int BerDecode(IAsn1DecodingBuffer buffer, bool explicitTag = true)
        {
            int     allLen = 0;
            Asn1Tag contextTag;

            allLen += TagBerDecode(buffer, out contextTag);
            switch (contextTag.TagValue)
            {
            case 0:
                field0  = new LDAPString();
                allLen += field0.BerDecodeWithoutUnisersalTag(buffer);
                SetData(1, field0);
                break;

            case 1:
                field1  = new LDAPString();
                allLen += field1.BerDecodeWithoutUnisersalTag(buffer);
                SetData(2, field1);
                break;

            case 2:
                field2  = new LDAPString();
                allLen += field2.BerDecodeWithoutUnisersalTag(buffer);
                SetData(3, field2);
                break;

            default:
                throw new Asn1DecodingUnexpectedData(ExceptionMessages.DecodingUnexpectedData + " AuthenticationChoice");
            }
            return(allLen);
        }
コード例 #6
0
 public AddResponse(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral)
     : base(resultCode, matchedDN, errorMessage, referral)
 {
 }
コード例 #7
0
 public SicilyBindResponse(
     SicilyBindResponse_resultCode resultCode,
     Asn1OctetString serverCreds,
     LDAPString errorMessage)
 {
     this.resultCode = resultCode;
     this.serverCreds = serverCreds;
     this.errorMessage = errorMessage;
 }
コード例 #8
0
 public SicilyBindResponse(
     SicilyBindResponse_resultCode resultCode,
     Asn1OctetString serverCreds,
     LDAPString errorMessage)
 {
     this.resultCode   = resultCode;
     this.serverCreds  = serverCreds;
     this.errorMessage = errorMessage;
 }
コード例 #9
0
 public LDAPResult(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral)
 {
     this.resultCode   = resultCode;
     this.matchedDN    = matchedDN;
     this.errorMessage = errorMessage;
     this.referral     = referral;
 }
コード例 #10
0
 public SearchResultDone(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral)
 {
     this.resultCode = resultCode;
     this.matchedDN = matchedDN;
     this.errorMessage = errorMessage;
     this.referral = referral;
 }
コード例 #11
0
 public ExtendedResponse(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral)
 {
     this.resultCode = resultCode;
     this.matchedDN = matchedDN;
     this.errorMessage = errorMessage;
     this.referral = referral;
     this.responseName = null;
     this.response = null;
 }
コード例 #12
0
 public BindResponse(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral,
     Asn1OctetString serverSaslCreds)
 {
     this.resultCode = resultCode;
     this.matchedDN = matchedDN;
     this.errorMessage = errorMessage;
     this.referral = referral;
     this.serverSaslCreds = serverSaslCreds;
 }
コード例 #13
0
 public ExtendedResponse(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral)
 {
     this.resultCode   = resultCode;
     this.matchedDN    = matchedDN;
     this.errorMessage = errorMessage;
     this.referral     = referral;
     this.responseName = null;
     this.response     = null;
 }
コード例 #14
0
 public BindResponse(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral,
     Asn1OctetString serverSaslCreds)
 {
     this.resultCode      = resultCode;
     this.matchedDN       = matchedDN;
     this.errorMessage    = errorMessage;
     this.referral        = referral;
     this.serverSaslCreds = serverSaslCreds;
 }
コード例 #15
0
 public ExtendedResponse(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral,
     LDAPOID responseName,
     Asn1OctetString response)
 {
     this.resultCode   = resultCode;
     this.matchedDN    = matchedDN;
     this.errorMessage = errorMessage;
     this.referral     = referral;
     this.responseName = responseName;
     this.response     = response;
 }
コード例 #16
0
 public ExtendedResponse(
     LDAPResult_resultCode resultCode,
     LDAPDN matchedDN,
     LDAPString errorMessage,
     Referral referral,
     LDAPOID responseName,
     Asn1OctetString response)
 {
     this.resultCode = resultCode;
     this.matchedDN = matchedDN;
     this.errorMessage = errorMessage;
     this.referral = referral;
     this.responseName = responseName;
     this.response = response;
 }
コード例 #17
0
        public override int BerDecode(IAsn1DecodingBuffer buffer, bool explicitTag = true)
        {
            int headLen = 0;
            Asn1Tag seqTag;
            headLen += TagBerDecode(buffer, out seqTag);
            int valueLen;
            headLen += LengthBerDecode(buffer, out valueLen);

            int valueLenDecode = 0;
            resultCode = new LDAPResult_resultCode();
            valueLenDecode += resultCode.BerDecode(buffer);
            matchedDN = new LDAPDN();
            valueLenDecode += matchedDN.BerDecode(buffer);
            errorMessage = new LDAPString();
            valueLenDecode += errorMessage.BerDecode(buffer);
            if (valueLenDecode == valueLen)
            {
                referral = null;
                serverSaslCreds = null;
            }
            else
            {
                Asn1Tag contextTag;
                valueLenDecode += TagBerDecode(buffer, out contextTag);
                if (contextTag.TagValue == 3)
                {
                    //referral
                    referral = new Referral();
                    valueLenDecode += referral.BerDecodeWithoutUnisersalTag(buffer);
                    if (valueLenDecode < valueLen)
                    {
                        valueLenDecode += TagBerDecode(buffer, out contextTag);
                    }
                }
                if (contextTag.TagValue == 7)
                {
                    //serverSaslCreds
                    serverSaslCreds = new Asn1OctetString();
                    valueLenDecode += serverSaslCreds.BerDecodeWithoutUnisersalTag(buffer);
                }
               }
            if (valueLen != valueLenDecode)
            {
                throw new Asn1DecodingUnexpectedData(ExceptionMessages.DecodingUnexpectedData + " BindResponse.");
            }
            return headLen + valueLen;
        }
コード例 #18
0
 public SicilyBindResponse()
 {
     this.resultCode   = null;
     this.serverCreds  = null;
     this.errorMessage = null;
 }
コード例 #19
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 returnVal = 0, lengthAfterUniTag = 0, tagLength = 0;

            if (explicitTag)
            {
                //Decode the top most tag and universal class tag
                Asn1Tag topTag;
                returnVal += TagBerDecode(buffer, out topTag);
            }

            returnVal += LengthBerDecode(buffer, out lengthAfterUniTag);
            Asn1Tag valueTag;

            //Decode data
            valueTag = new Asn1Tag(Asn1TagType.Universal, 10)
            {
                EncodingWay = EncodingWay.Primitive
            };
            if (IsTagMatch(buffer, valueTag, out tagLength))
            {
                resultCode = new LDAPResult_resultCode();
                returnVal += resultCode.BerDecode(buffer, true);
            }

            valueTag = new Asn1Tag(Asn1TagType.Universal, 4)
            {
                EncodingWay = EncodingWay.Primitive
            };
            if (IsTagMatch(buffer, valueTag, out tagLength))
            {
                matchedDN  = new LDAPDN();
                returnVal += matchedDN.BerDecode(buffer, true);
            }

            // decode errorMessage
            valueTag = new Asn1Tag(Asn1TagType.Universal, 4)
            {
                EncodingWay = EncodingWay.Primitive
            };
            if (IsTagMatch(buffer, valueTag, out tagLength))
            {
                errorMessage = new LDAPString();
                returnVal   += errorMessage.BerDecode(buffer, true);
            }

            // decode referral
            valueTag = new Asn1Tag(Asn1TagType.Context, 3)
            {
                EncodingWay = EncodingWay.Constructed
            };
            if (IsTagMatch(buffer, valueTag, out tagLength))
            {
                referral   = new Referral();
                returnVal += referral.BerDecode(buffer, false);
            }

            // decode responseName
            valueTag = new Asn1Tag(Asn1TagType.Context, 10)
            {
                EncodingWay = EncodingWay.Primitive
            };
            if (IsTagMatch(buffer, valueTag, out tagLength, true))
            {
                responseName = new LDAPOID();
                returnVal   += responseName.BerDecode(buffer, false);
            }

            // decode response
            valueTag = new Asn1Tag(Asn1TagType.Context, 11)
            {
                EncodingWay = EncodingWay.Primitive
            };
            if (IsTagMatch(buffer, valueTag, out tagLength, true))
            {
                response   = new Asn1OctetString();
                returnVal += response.BerDecode(buffer, false);
            }

            return(returnVal);
        }