public AuthenticationInfo buildAuthenticationInfo(Authorization authorization, Entity responseEntity)
        {
            log.enteredMethod();

            AuthenticationInfo answer = new AuthenticationInfo();

            answer.cnonce = _cnonce;
            answer.nc = _nc;
            answer.nextnonce = _nonce;
            answer.qop = authorization.qop;

            /*
            * rspauth field
            */
            String ha1 = _registeredSubject.ha1();


            // from RFC-2617, section 3.2.3, we leave the method out ...   
            String ha2 = getHa2("", authorization.qop, authorization.uri, responseEntity);

            String unhashedRspauth = String.Format("{0}:{1}:{2:x8}:{3}:{4}:{5}",
                ha1, authorization.nonce, authorization.nc,
                authorization.cnonce, authorization.qop, ha2);

            String rspauth = SecurityUtilities.md5HashOfString(unhashedRspauth);
            answer.rspauth = rspauth;

            return answer;
        }
        ///////////////////////////////////////////////////////////////////////

        public static AuthenticationInfo buildFromString(String authInfo)
        {
            AuthenticationInfo answer = new AuthenticationInfo();

            AuthenticationHeaderScanner authenticationHeaderScanner = new AuthenticationHeaderScanner(authInfo);

            authenticationHeaderScanner.scanPastDigestString();

            String name = authenticationHeaderScanner.scanName();

            while (null != name)
            {
                if ("cnonce".Equals(name))
                {
                    String value = authenticationHeaderScanner.scanQuotedValue();

                    answer._cnonce = value;
                }
                else if ("nextnonce".Equals(name))
                {
                    String value = authenticationHeaderScanner.scanQuotedValue();

                    answer._nextnonce = value;
                    
                }
                else if ("nc".Equals(name))
                {
                    uint value = authenticationHeaderScanner.scanHexUInt32();

                    answer._nc = value;
                }
                else if ("qop".Equals(name))
                {
                    String value = authenticationHeaderScanner.scanValue();

                    answer._qop = value;
                }
                else if ("rspauth".Equals(name))
                {
                    String value = authenticationHeaderScanner.scanQuotedValue();

                    answer._rspauth = value;

                } else {

                    // 'auth-param' is not permitted according to 3.2.3 of RFC-2617
                    // 'auth-param' in section 3.2.1 of RFC-2617 says ... 
                    // Any unrecognized directive MUST be ignored.
                    //
                    // For consistency, we mimic the behaviour specified in sections 3.2.1 & 3.2.2 in relation to 'auth-param'

                    String value = authenticationHeaderScanner.scanQuotedValue();
                    String warning = String.Format("unrecognised name-value pair. name = '{0}', value = '{1}'", name, value);
                    log.warn(warning);

                }

                name = authenticationHeaderScanner.scanName();

            }




            return answer;

        }