/// <summary>
        /// Decode
        /// </summary>
        /// <param name="digestCredentials">http digest credentials string</param>
        /// <param name="dpspResponse">dpspResponse instance</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown when digestCredentials or digestCredentials is null
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Thrown when digestCredentials or dpspResponse is invalid
        /// </exception>
        protected static void Decode(
            string digestCredentials,
            DpspResponse dpspResponse)
        {
            if (digestCredentials == null)
            {
                throw new ArgumentNullException("digestCredentials");
            }

            if (digestCredentials.Length == 0)
            {
                throw new ArgumentException(
                          "digestCredentials should not be empty",
                          "digestCredentials");
            }

            if (dpspResponse == null)
            {
                throw new ArgumentNullException("dpspResponse");
            }

            digestCredentials = digestCredentials.TrimStart();

            if (!digestCredentials.StartsWith(DpspUtility.DIGEST + DpspUtility.SPACE))
            {
                throw new ArgumentException(
                          "digestResponseCredentials should start with " + DpspUtility.DIGEST + "(SPACE)",
                          "digestCredentials");
            }

            // ABNF credentials = "Digest" digest-response
            string digestResponse = digestCredentials.Substring(DpspUtility.DIGEST.Length + DpspUtility.SPACE.Length);

            Regex regex = new Regex(
                DpspUtility.ATTRIBUTE_VALUE_PAIR_REGULAR_EXPRESSION_PATTERN,
                RegexOptions.IgnorePatternWhitespace);

            MatchCollection matchCollection = regex.Matches(digestResponse);

            if (matchCollection.Count == 0)
            {
                throw new ArgumentException("invalid digestResponse", "digestCredentials");
            }

            foreach (Match match in matchCollection)
            {
                string key;
                string value;

                if (match.Groups[DpspUtility.Attribute].Success)
                {
                    key = match.Groups[DpspUtility.Attribute].Value;
                }
                else
                {
                    throw new ArgumentException("invalid digestResponse", "digestCredentials");
                }

                if (match.Groups[DpspUtility.VALUE].Success)
                {
                    value = match.Groups[DpspUtility.VALUE].Value;
                }
                else
                {
                    throw new ArgumentException("invalid digestResponse", "digestCredentials");
                }

                dpspResponse.SetAttributeValue(key, value);
            }
        }
        /// <summary>
        /// Decode
        /// </summary>
        /// <param name="digestCredentials">http digest credentials string</param>
        /// <param name="dpspResponse">dpspResponse instance</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown when digestCredentials or digestCredentials is null 
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Thrown when digestCredentials or dpspResponse is invalid 
        /// </exception>
        protected static void Decode(
            string digestCredentials,
            DpspResponse dpspResponse)
        {
            if (digestCredentials == null)
            {
                throw new ArgumentNullException("digestCredentials");
            }

            if (digestCredentials.Length == 0)
            {
                throw new ArgumentException(
                    "digestCredentials should not be empty",
                    "digestCredentials");
            }

            if (dpspResponse == null)
            {
                throw new ArgumentNullException("dpspResponse");
            }

            digestCredentials = digestCredentials.TrimStart();

            if (!digestCredentials.StartsWith(DpspUtility.DIGEST + DpspUtility.SPACE))
            {
                throw new ArgumentException(
                    "digestResponseCredentials should start with " + DpspUtility.DIGEST + "(SPACE)",
                    "digestCredentials");
            }

            // ABNF credentials = "Digest" digest-response
            string digestResponse = digestCredentials.Substring(DpspUtility.DIGEST.Length + DpspUtility.SPACE.Length);

            Regex regex = new Regex(
                DpspUtility.ATTRIBUTE_VALUE_PAIR_REGULAR_EXPRESSION_PATTERN,
                RegexOptions.IgnorePatternWhitespace);

            MatchCollection matchCollection = regex.Matches(digestResponse);

            if (matchCollection.Count == 0)
            {
                throw new ArgumentException("invalid digestResponse", "digestCredentials");
            }

            foreach (Match match in matchCollection)
            {
                string key;
                string value;

                if (match.Groups[DpspUtility.Attribute].Success)
                {
                    key = match.Groups[DpspUtility.Attribute].Value;
                }
                else
                {
                    throw new ArgumentException("invalid digestResponse", "digestCredentials");
                }

                if (match.Groups[DpspUtility.VALUE].Success)
                {
                    value = match.Groups[DpspUtility.VALUE].Value;
                }
                else
                {
                    throw new ArgumentException("invalid digestResponse", "digestCredentials");
                }

                dpspResponse.SetAttributeValue(key, value);
            }
        }