private static ByteString HexHA2(MD5 h, ByteString qop, ByteString digestUri)
        {
            //    If the "qop" directive's value is "auth", then A2 is:
              //
              //       A2       = { "AUTHENTICATE:", digest-uri-value }
              //
              //    If the "qop" value is "auth-int" or "auth-conf" then A2 is:
              //
              //       A2       = { "AUTHENTICATE:", digest-uri-value,
              //                ":00000000000000000000000000000000" }
              var a2 = new ByteStringBuilder(0x80);

              a2.Append("AUTHENTICATE:");
              a2.Append(digestUri);

              if (qop.EqualsIgnoreCase("auth-int") || qop.EqualsIgnoreCase("auth-conf"))
            a2.Append(":00000000000000000000000000000000");

              return HexH(h, a2.ToByteString());
        }
Exemple #2
0
        public void TestEqualsIgnoreCase()
        {
            var a = new ByteString("abc");
              var b = new ByteString("ABC");
              var c = new ByteString("Abc");
              var d = new ByteString("AbcD");

              Assert.IsTrue(a.EqualsIgnoreCase(b));
              Assert.IsTrue(a.EqualsIgnoreCase(c));
              Assert.IsFalse(a.EqualsIgnoreCase(d));
        }