Exemplo n.º 1
0
        public void SipAuthorizationValue_Compute()
        {
            SipAuthenticateValue  vChallenge;
            SipAuthorizationValue vResponse;

            vChallenge = new SipAuthenticateValue("Digest realm=\"asterisk\", nonce=\"5c9dda7a\"");
            vResponse  = new SipAuthorizationValue(vChallenge, "jslill", "q0jsrd7y", "REGISTER", "sip:sip4.vitelity.net");

            Assert.AreEqual("394487a182712a1c348c3861ee6465f8", vResponse.Response);
        }
Exemplo n.º 2
0
        public void SipAuthorizationValue_Message()
        {
            SipRequest            message = new SipRequest(SipMethod.Invite, "sip:[email protected]", null);
            SipAuthenticateValue  vChallenge;
            SipAuthorizationValue vResponse;
            SipAuthorizationValue v;

            vChallenge = new SipAuthenticateValue("Digest realm=\"asterisk\", nonce=\"5c9dda7a\"");
            vResponse  = new SipAuthorizationValue(vChallenge, "jslill", "q0jsrd7y", "REGISTER", "sip:sip4.vitelity.net");

            Assert.IsNull(message.GetHeader <SipAuthorizationValue>(SipHeader.Authorization));

            message.AddHeader(SipHeader.Authorization, vResponse);
            v = message.GetHeader <SipAuthorizationValue>(SipHeader.Authorization);
            Assert.IsNotNull(v);
            Assert.AreEqual(vResponse.Response, v.Response);
        }
Exemplo n.º 3
0
        public void SipAuthenticateValue_Basic()
        {
            SipAuthenticateValue v;
            string s;

            v = new SipAuthenticateValue(" Digest algorithm=MD5, realm=\"asterisk\", nonce=\"5c9dda7a\"");
            Assert.AreEqual("MD5", v["algorithm"]);
            Assert.AreEqual("asterisk", v["realm"]);
            Assert.IsNull(v["domain"]);
            Assert.AreEqual("5c9dda7a", v["nonce"]);
            Assert.IsNull(v["opaque"]);
            Assert.IsNull(v["stale"]);

            s = v.ToString();
            Assert.IsTrue(s.StartsWith("Digest"));
            Assert.IsTrue(s.IndexOf("algorithm=MD5") != -1);
            Assert.IsTrue(s.IndexOf("realm=\"asterisk\"") != -1);
            Assert.IsTrue(s.IndexOf("domain=") == -1);
            Assert.IsTrue(s.IndexOf("nonce=\"5c9dda7a\"") != -1);
            Assert.IsTrue(s.IndexOf("opaque=") == -1);
            Assert.IsTrue(s.IndexOf("stale=") == -1);
        }