コード例 #1
0
        internal static string CreateRequestDigest(NameValueCollection parameters)
        {
            string item  = parameters["username"];
            string str   = parameters["password"];
            string item1 = parameters["realm"];
            string str1  = parameters["nonce"];
            string item2 = parameters["uri"];
            string str2  = parameters["algorithm"];
            string item3 = parameters["qop"];
            string str3  = parameters["cnonce"];
            string item4 = parameters["nc"];
            string str4  = parameters["method"];
            string str5  = (str2 == null || !(str2.ToLower() == "md5-sess") ? AuthenticationResponse.createA1(item, str, item1) : AuthenticationResponse.createA1(item, str, item1, str1, str3));
            string str6  = (item3 == null || !(item3.ToLower() == "auth-int") ? AuthenticationResponse.createA2(str4, item2) : AuthenticationResponse.createA2(str4, item2, parameters["entity"]));
            string str7  = AuthenticationResponse.hash(str5);
            string str8  = (item3 != null ? string.Format("{0}:{1}:{2}:{3}:{4}", new object[] { str1, item4, str3, item3, AuthenticationResponse.hash(str6) }) : string.Format("{0}:{1}", str1, AuthenticationResponse.hash(str6)));
            string str9  = AuthenticationResponse.hash(string.Format("{0}:{1}", str7, str8));

            return(str9);
        }
コード例 #2
0
        private static string createA1(string username, string password, string realm, string nonce, string cnonce)
        {
            string str = string.Format("{0}:{1}:{2}", AuthenticationResponse.hash(AuthenticationResponse.createA1(username, password, realm)), nonce, cnonce);

            return(str);
        }