incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ket...@apache.org
Subject svn commit: r463009 [2/4] - in /incubator/heraldry/libraries/csharp: ./ openid/ openid/trunk/ openid/trunk/Janrain.OpenId/ openid/trunk/Janrain.OpenId/Examples/ openid/trunk/Janrain.OpenId/Examples/Consumer/ openid/trunk/Janrain.OpenId/Examples/Consume...
Date Wed, 11 Oct 2006 22:24:54 GMT
Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Janrain.OpenId/KVUtil.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Janrain.OpenId/KVUtil.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Janrain.OpenId/KVUtil.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Janrain.OpenId/KVUtil.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,81 @@
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+
+namespace Janrain.OpenId
+{
+    class ValueError : ApplicationException 
+    {
+        public ValueError ( string msg ) : 
+	    base(msg) 
+	{ }
+    }
+
+
+    public class KVUtil
+    {
+        private KVUtil () { }
+
+        private static void Error(string msg, bool strict)
+        {
+            if (strict)
+                throw new ValueError(msg);
+            // XXX: else: log msg
+        }
+
+        public static byte[] SeqToKV(NameValueCollection seq, bool strict)
+        {
+	    MemoryStream ms = new MemoryStream();
+	    byte[] line;
+            foreach (string key in seq)
+            {
+		string val = seq[key];
+                if (key.IndexOf('\n') >= 0)
+                    throw new ValueError("Invalid input for SeqToKV: key contains newline");
+
+                if (key.Trim().Length != key.Length)
+                    Error(String.Format("Key has whitespace at beginning or end: {0}", key), strict);
+
+                if (val.IndexOf('\n') >= 0)
+                    throw new ValueError("Invalid input for SeqToKV: value contains newline");
+
+                if (val.Trim().Length != val.Length)
+                    Error(String.Format("Value has whitespace at beginning or end: {0}", val), strict);
+
+		line = Encoding.UTF8.GetBytes(String.Format("{0}:{1}\n", key, val));
+                ms.Write(line, 0, line.Length);
+            }
+            return ms.ToArray();
+        }
+
+        public static byte[] DictToKV(NameValueCollection data)
+        {
+            return SeqToKV(data, false);
+        }
+
+        public static NameValueCollection KVToDict(byte[] data)
+        {
+	    StringReader reader = new StringReader(UTF8Encoding.UTF8.GetString(data));
+
+	    string line;
+	    NameValueCollection nvc = new NameValueCollection();
+            int line_num = 0;
+	    while((line = reader.ReadLine()) != null)
+	    {
+		line_num += 1;
+		if (line.Trim().Length > 0)
+		{
+		    string[] parts = line.Split(new char[] { ':', }, 2);
+		    if (parts.Length != 2)
+			Error(String.Format("Line {0} does not contain a colon", line_num.ToString()), false);
+		    else
+			nvc[parts[0]] = parts[1];
+		}
+            }
+
+            return nvc;
+        }
+    }
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Janrain.OpenId/Util.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Janrain.OpenId/Util.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Janrain.OpenId/Util.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Janrain.OpenId/Util.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,53 @@
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web;
+
+namespace Janrain.OpenId
+{
+    public class UriUtil
+    {
+        private UriUtil () 
+	{ }
+
+        public static Uri NormalizeUri(string uriString)
+        {
+            if ((!uriString.StartsWith("http")) && (uriString.IndexOf("://") == -1))
+		uriString = "http://" + uriString;
+            
+            UriBuilder bldr = new UriBuilder(uriString);
+            bldr.Host = bldr.Host.ToLower();
+            return bldr.Uri;
+        }
+	
+	public static string CreateQueryString(NameValueCollection args)
+	{
+	    string encKey, encVal;
+	    string[] parts = new string[args.Count];
+	    uint i = 0;
+	    foreach (string key in args)
+	    {
+		encKey = HttpUtility.UrlEncode(key);
+		encVal = HttpUtility.UrlEncode(args[key]);
+		parts[i] = String.Format("{0}={1}", encKey, encVal);
+		i++;
+	    }
+	    return String.Join("&", parts);
+	}
+
+	public static void AppendQueryArgument(UriBuilder builder, string key, string value)
+	{
+	    NameValueCollection c = new NameValueCollection();
+	    c.Add(key, value);
+	    string newqs = CreateQueryString(c);
+	    string qs = builder.Query;
+	    if (builder.Query != null && qs != String.Empty)
+		qs = String.Format("{0}&{1}", qs.Substring(1), newqs);
+	    else
+		qs = newqs;
+	    builder.Query = qs;
+	}
+    }
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Makefile
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Makefile?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Makefile (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Makefile Wed Oct 11 15:24:51 2006
@@ -0,0 +1,69 @@
+# -*- makefile -*-
+CSC=mcs
+
+SOURCES=Janrain.OpenId/Association.cs \
+	Janrain.OpenId/CryptUtil.cs \
+	Janrain.OpenId/KVUtil.cs \
+	Janrain.OpenId/Util.cs \
+	Janrain.OpenId.Consumer/Consumer.cs \
+	Janrain.OpenId.Consumer/Fetcher.cs \
+	Janrain.OpenId.Consumer/FetchException.cs \
+	Janrain.OpenId.Consumer/FetchResponse.cs \
+	Janrain.OpenId.Consumer/SimpleFetcher.cs \
+	Janrain.OpenId.Consumer/Parse.cs \
+	Janrain.OpenId.Store/FileStore.cs \
+	Janrain.OpenId.Store/IAssociationStore.cs \
+	Janrain.OpenId.Store/SQLStore.cs
+
+ASP_SOURCES=Janrain.OpenId.Consumer.Net/OpenIdModule.cs \
+	Janrain.OpenId.Store.Net/MemoryStore.cs
+
+TEST_SOURCES=Tests/Janrain.OpenId/Association.cs \
+	Tests/Janrain.OpenId/MemoryStore.cs \
+	Tests/Janrain.OpenId/DH.cs \
+	Tests/Janrain.OpenId.Consumer/Fetchers.cs \
+	Tests/Janrain.OpenId.Consumer/Parse.cs \
+	Tests/Janrain.OpenId.Consumer/Consumer.cs \
+	Tests/Janrain.OpenId.Store/Generic.cs
+
+MYSQL_SOURCES=Janrain.OpenId.Store/MySqlStore.cs
+MYSQL_TEST_SOURCES=Tests/Janrain.OpenId.Store/MySqlStore.cs
+
+TEST_ASSEMBLY_SOURCES=TestHarness/TestAssembly.cs
+TEST_HARNESS_SOURCES=TestHarness/Janrain.TestHarness/TestHarness.cs
+
+ALL=TestAssembly.exe TestHarness.dll OpenIdTest.dll Janrain.OpenId.dll Janrain.OpenId.Consumer.Net.dll
+
+all: $(ALL) mysql 
+
+mysql: Janrain.OpenId.Store.MySql.dll OpenIdTest.Store.MySql.dll
+
+doc: Janrain.OpenId.dll Janrain.OpenId.Consumer.Net.dll
+	ndoc-console Janrain.OpenId.dll,Janrain.OpenId.xml Janrain.OpenId.Consumer.Net.dll,Janrain.OpenId.Consumer.Net.xml -documenter=MSDN || true
+	mv doc/ndoc_msdn_temp/* doc/ && rmdir doc/ndoc_msdn_temp/
+
+Janrain.OpenId.Store.MySql.dll: $(MYSQL_SOURCES) Janrain.OpenId.dll
+	$(CSC) -debug+ -define:DEBUG -reference:System.Data,Janrain.OpenId,ByteFX.Data -target:library -out:$@ $(MYSQL_SOURCES)
+
+OpenIdTest.Store.MySql.dll: $(MYSQL_TEST_SOURCES) Janrain.OpenId.Store.MySql.dll Janrain.OpenId.dll TestHarness.dll OpenIdTest.dll
+	$(CSC) -debug+ -define:DEBUG -reference:TestHarness,Janrain.OpenId,OpenIdTest,Janrain.OpenId.Store.MySql,ByteFX.Data -target:library -out:$@ $(MYSQL_TEST_SOURCES)
+
+Janrain.OpenId.Consumer.Net.dll: $(ASP_SOURCES)
+	$(CSC) -debug+ -define:DEBUG -reference:System.Web,Janrain.OpenId -target:library -doc:Janrain.OpenId.Consumer.Net.xml -out:$@ $(ASP_SOURCES)
+
+TestAssembly.exe: $(TEST_ASSEMBLY_SOURCES) TestHarness.dll
+	$(CSC) -debug+ -define:DEBUG -reference:TestHarness -target:exe -out:$@ $(TEST_ASSEMBLY_SOURCES)
+
+OpenIdTest.dll: $(TEST_SOURCES) TestHarness.dll Janrain.OpenId.dll
+	$(CSC) -debug+ -define:DEBUG -reference:Mono.Security,System.Web,TestHarness,Janrain.OpenId -target:library -out:$@ $(TEST_SOURCES)
+
+TestHarness.dll: $(TEST_HARNESS_SOURCES)
+	$(CSC) -debug+ -define:DEBUG -target:library -out:$@ $(TEST_HARNESS_SOURCES)
+
+Janrain.OpenId.dll: $(SOURCES)
+	$(CSC) -debug+ -define:DEBUG -reference:Mono.Security,System.Web,System.Data -target:library -doc:Janrain.OpenId.xml -out:$@ $(SOURCES)
+
+clean:
+	find . -type f -name "*.mdb" | xargs rm -f
+	find . -type f -name "*.dll" | xargs rm -f
+	find . -type f -name "*.exe" | xargs rm -f

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/TestHarness/Janrain.TestHarness/TestHarness.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/TestHarness/Janrain.TestHarness/TestHarness.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/TestHarness/Janrain.TestHarness/TestHarness.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/TestHarness/Janrain.TestHarness/TestHarness.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,33 @@
+using System;
+using System.Reflection;
+
+namespace Janrain.TestHarness
+{
+    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
+    public class TestSuiteAttribute : Attribute { }
+
+    [AttributeUsage(AttributeTargets.Method)]
+    public class TestAttribute : Attribute { }
+
+    public class AssertionException : ApplicationException 
+    { 
+	public AssertionException(string message) : base(message) { }
+    }
+
+    public class TestTools
+    {
+	private TestTools () {}
+
+	public static void Assert(bool assertion)
+	{
+	    Assert(assertion, "Assertion Error");
+	}
+
+	public static void Assert(bool assertion, string message)
+	{
+	    if ( !assertion )
+		throw new AssertionException(message);
+	}
+    }
+    
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/TestHarness/TestAssembly.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/TestHarness/TestAssembly.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/TestHarness/TestAssembly.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/TestHarness/TestAssembly.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,75 @@
+using System;
+using System.Reflection;
+using Janrain.TestHarness;
+
+
+class TestAssembly
+{
+    public static void Main ( string[] args )
+    {
+        Assembly assembly = Assembly.LoadFrom (args[0]);
+
+        BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public |
+                BindingFlags.Static | BindingFlags.Instance | 
+                BindingFlags.DeclaredOnly);
+
+        object[] typeAttrs, methodAttrs;
+        string msg;
+        object inst;
+        foreach (Type type in assembly.GetTypes()) {
+            typeAttrs = type.GetCustomAttributes(
+                    typeof(TestSuiteAttribute), true);
+            if (typeAttrs.Length == 0)
+                continue;
+
+        msg = String.Format("TestSuite: {0} in {1}", 
+                type.Name, type.Namespace);
+        Console.WriteLine(msg);
+        Console.WriteLine("".PadLeft(msg.Length, '='));
+
+        inst = Activator.CreateInstance(type);
+        foreach (MethodInfo method in type.GetMethods())
+        {
+        methodAttrs = method.GetCustomAttributes(
+            typeof(TestAttribute), true);
+        if (methodAttrs.Length == 0)
+            continue;
+
+        Console.WriteLine("Running {0} Test:", method.Name);
+        try
+        {
+            method.Invoke(inst, new object[0]);
+        }
+        catch (Exception e)
+        {
+            Console.WriteLine("Error Running Test: {0} in {1}", 
+                      method.Name, type.FullName);
+            if (e.InnerException == null)
+            throw e;
+            throw e.InnerException;
+        }
+        Console.WriteLine("Succeeded!");
+        }
+        Console.WriteLine();
+        }
+
+        //MethodInfo[] mi = t.GetMethods(flags);
+
+        //
+
+
+
+
+
+        /*      // Print the Class Name
+        
+        // Print the name space
+        Console.WriteLine ("Type Namespace : {0}", type.Namespace); 
+        // Print the Base Class Name
+        Console.WriteLine ("Type Base Class : {0}",  
+                   (type.BaseType != null) ?  
+                   type.BaseType.FullName :  
+                   "No Base Class Found...");
+                   Console.WriteLine("");*/
+    }
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Consumer.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Consumer.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Consumer.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Consumer.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,419 @@
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Web;
+
+using Mono.Security.Cryptography;
+
+using Janrain.TestHarness;
+using Janrain.OpenId;
+using Janrain.OpenId.Consumer;
+using Janrain.OpenId.Store;
+
+namespace OpenIdTest.OpenId
+{
+    class AssociationInfo
+    {
+	public byte[] secret;
+	public string handle;
+	public AssociationInfo(byte[] secret, string handle)
+	{
+	    this.secret = secret;
+	    this.handle = handle;
+	}
+    }
+
+    class FormParser
+    {
+	private FormParser() {}
+
+	private static void AddRawKeyValue(StringBuilder key, StringBuilder val, NameValueCollection form)
+	{
+	    form.Add (HttpUtility.UrlDecode(key.ToString (), Encoding.UTF8),
+		      HttpUtility.UrlDecode(val.ToString (), Encoding.UTF8)
+		      );
+
+	    key.Length = 0;
+	    val.Length = 0;
+	}
+
+	// Implementation taken from Mono's System.Web.HttpRequest
+	public static NameValueCollection Parse(byte[] data)
+	{
+	    NameValueCollection form = new NameValueCollection();
+	    Stream input = new MemoryStream(data);
+	    StreamReader s = new StreamReader (input, Encoding.UTF8);
+	    
+	    StringBuilder key = new StringBuilder ();
+	    StringBuilder value = new StringBuilder ();
+	    int c;
+
+	    while ((c = s.Read ()) != -1){
+		if (c == '='){
+		    value.Length = 0;
+		    while ((c = s.Read ()) != -1){
+			if (c == '&'){
+			    AddRawKeyValue (key, value, form);
+			    break;
+			} else
+			    value.Append ((char) c);
+		    }
+		    if (c == -1){
+			AddRawKeyValue (key, value, form);
+			return form;
+		    }
+		} else if (c == '&')
+		    AddRawKeyValue (key, value, form);
+		else
+		    key.Append ((char) c);
+	    }
+	    if (c == -1)
+		AddRawKeyValue (key, value, form);
+	    
+	    return form;
+	}
+	
+    }
+
+    class TestFetcher : Fetcher
+    {
+	public Hashtable getResponses;
+	AssociationInfo assoc;
+	
+	public TestFetcher(Uri userUri, string userPage, AssociationInfo ainfo)
+	{
+	    this.assoc = ainfo;
+	    this.getResponses = new Hashtable();
+
+	    byte[] data = Encoding.UTF8.GetBytes(userPage);
+	    FetchResponse resp = new FetchResponse(
+		HttpStatusCode.OK, userUri, "UTF-8", data, data.Length);
+	    this.getResponses.Add(userUri, resp);
+	}
+
+	private byte[] Associate(byte[] data)
+	{
+	    NameValueCollection q = FormParser.Parse(data);
+	    TestTools.Assert(q.Count == 6);
+	    TestTools.Assert(q["openid.mode"] == "associate");
+	    TestTools.Assert(q["openid.assoc_type"] == "HMAC-SHA1");
+	    TestTools.Assert(q["openid.session_type"] == "DH-SHA1");
+	    
+	    DiffieHellman d = new DiffieHellmanManaged(
+	        Convert.FromBase64String(q["openid.dh_modulus"]),
+		Convert.FromBase64String(q["openid.dh_gen"]), 1024);
+
+	    byte[] enc_mac_key = CryptUtil.SHA1XorSecret(d, 
+	        Convert.FromBase64String(q["openid.dh_consumer_public"]), 
+		this.assoc.secret);
+
+	    byte[] dhPublic = d.CreateKeyExchange();
+	    string spub = CryptUtil.UnsignedToBase64(dhPublic);
+
+	    NameValueCollection reply = new NameValueCollection();
+	    reply.Add("assoc_type", "HMAC-SHA1");
+	    reply.Add("assoc_handle", this.assoc.handle);
+	    reply.Add("expires_in", "600");
+	    reply.Add("session_type", "DH-SHA1");
+	    reply.Add("dh_server_public", spub);
+	    reply.Add("enc_mac_key", CryptUtil.ToBase64String(enc_mac_key));
+	    return KVUtil.DictToKV(reply);
+	}
+
+	private FetchResponse Response(Uri url, byte[] data)
+	{
+	    if (data == null)
+		throw new FetchException(
+		    new FetchResponse(HttpStatusCode.NotFound, url, "UTF-8",
+				      new byte[0], 0), "Not Found");
+	    
+	    return new FetchResponse(HttpStatusCode.OK, url, "UTF-8",
+				     data, data.Length);
+	}
+
+        #region Fetcher Members
+
+	public override FetchResponse Get(Uri uri, uint maxRead)
+	{
+	    FetchResponse ret = (FetchResponse) this.getResponses[uri];
+	    if (ret == null)
+		ret = Response(uri, null);
+	    return ret;
+	}
+
+	public override FetchResponse Post(Uri uri, byte[] body, uint maxRead)
+	{
+	    if (Encoding.UTF8.GetString(body).IndexOf("openid.mode=associate") < 0)
+		return Response(uri, null);
+	    
+	    return Response(uri, Associate(body));
+	}
+
+        #endregion
+    }
+
+    class BadFetcher : Fetcher
+    {
+	FetchResponse resp;
+	string message;
+
+	public BadFetcher(FetchResponse resp)
+	{
+	    this.resp = resp;
+	    this.message = "barf";
+	}
+
+	public override FetchResponse Get(Uri uri, uint maxRead)
+	{
+	    throw new FetchException(this.resp, this.message);
+	}
+	
+	public override FetchResponse Post(Uri uri, byte[] body, uint maxRead)
+	{
+	    throw new FetchException(this.resp, this.message);
+	}
+    }
+    
+
+    [TestSuite]
+    public class ConsumerTestSuite
+    {
+	static string USER_PAGE_PAT = @"<html>
+  <head>
+    <title>A user page</title>
+    {0}
+  </head>
+  <body>
+    blah blah
+  </body>
+</html>";
+	static Uri serverUri = new Uri("http://server.example.com/");
+	static Uri consumerUri = new Uri("http://consumer.example.com/");
+
+	private void Success(Uri userUri, Uri delegateUri, string links, Consumer.Mode immediate)
+	{
+	    MemoryStore store = new MemoryStore();
+	    
+	    string mode;
+	    if (immediate == Consumer.Mode.IMMEDIATE)
+		mode = "checkid_immediate";
+	    else
+		mode = "checkid_setup";
+
+	    string userPage = String.Format(USER_PAGE_PAT, links);
+	    string test_handle = "Snarky";
+	    AssociationInfo info = new AssociationInfo(
+                Encoding.ASCII.GetBytes("another 20-byte key."), test_handle);
+	    Fetcher fetcher = new TestFetcher(userUri, userPage, info);
+
+	    Consumer consumer = new Consumer(store, fetcher);
+
+	    AuthRequest request = consumer.BeginAuth(userUri);
+	    Uri returnTo = new Uri(consumerUri.AbsoluteUri, true);
+	    string trustRoot = consumerUri.AbsoluteUri;
+	    Uri redirectUri = consumer.CreateRedirect(immediate, request, returnTo, trustRoot);
+	    
+	    NameValueCollection q = FormParser.Parse(Encoding.UTF8.GetBytes(redirectUri.Query.Substring(1)));
+
+	    string errmsg = redirectUri.AbsoluteUri;
+	    TestTools.Assert(q.Count == 5, errmsg);
+	    TestTools.Assert(q["openid.mode"] == mode, errmsg);
+	    TestTools.Assert(q["openid.identity"] == delegateUri.AbsoluteUri, errmsg);
+	    TestTools.Assert(q["openid.trust_root"] == trustRoot, errmsg);
+	    TestTools.Assert(q["openid.assoc_handle"] == test_handle, errmsg);
+	    TestTools.Assert(q["openid.return_to"] == returnTo.AbsoluteUri, errmsg);
+
+	    TestTools.Assert(redirectUri.AbsoluteUri.StartsWith(serverUri.AbsoluteUri), errmsg);
+
+
+	    NameValueCollection query = new NameValueCollection();
+	    query.Add("openid.mode", "id_res");
+	    query.Add("openid.return_to", returnTo.AbsoluteUri);
+	    query.Add("openid.identity", delegateUri.AbsoluteUri);
+	    query.Add("openid.assoc_handle", test_handle);
+
+	    Association assoc = store.GetAssociation(serverUri, test_handle);
+	    string sig = assoc.SignDict(new string[] { "mode", "return_to", "identity" }, query, "openid.");
+
+	    query.Add("openid.sig", sig);
+	    query.Add("openid.signed", "mode,return_to,identity");
+
+	    object result;
+	    Consumer.Status status = consumer.CompleteAuth(request.token, query, out result);
+	    TestTools.Assert(status == Consumer.Status.SUCCESS);
+	    TestTools.Assert(((Uri)result).AbsoluteUri == userUri.AbsoluteUri, String.Format("info:{0}\nuserUri:{1}", info, userUri));
+	}
+
+	[Test]
+	public void Success()
+	{
+	    Uri userUri = new Uri("http://www.example.com/user.html");
+	    string links = String.Format("<link rel=\"openid.server\" href=\"{0}\" />", serverUri);
+	    
+	    Uri delegateUri = new Uri("http://consumer.example.com/user");
+	    string delegateLinks = String.Format(@"<link rel=""openid.server"" href=""{0}"" />
+                <link rel=""openid.delegate"" href=""{1}"" />", serverUri, delegateUri);
+
+	    Success(userUri, userUri, links, Consumer.Mode.SETUP);
+	    Success(userUri, userUri, links, Consumer.Mode.IMMEDIATE);
+	    Success(userUri, delegateUri, delegateLinks, Consumer.Mode.SETUP);
+	    Success(userUri, delegateUri, delegateLinks, Consumer.Mode.IMMEDIATE);
+	}
+
+	[Test]
+	public void BadFetch()
+	{
+	    Uri userUrl = new Uri("http://who.cares/");
+	    IAssociationStore store = new MemoryStore();
+	    Consumer consumer;
+	    
+	    
+	    ArrayList cases = new ArrayList();
+	    cases.Add(null);
+	    cases.Add(HttpStatusCode.NotFound);
+	    cases.Add(HttpStatusCode.BadRequest);
+	    cases.Add(HttpStatusCode.InternalServerError);
+	    	    
+	    byte[] data = Encoding.UTF8.GetBytes("Who cares?");
+	    FetchResponse resp;
+	    foreach (object code in cases)
+	    {
+		if (code == null)
+		    resp = null;
+		else
+		    resp = new FetchResponse((HttpStatusCode) code, userUrl, "UTF-8", data, data.Length);
+
+		consumer = new Consumer(store, new BadFetcher(resp));
+		try
+		{
+		    consumer.BeginAuth(userUrl);
+		    TestTools.Assert(false, String.Format("Consumer failed to raise FetchException: {0}", code.ToString()));
+		}
+		catch (FetchException e) {}
+	    }
+	}
+
+	[Test]
+	public void BadParse()
+	{
+	    IAssociationStore store = new MemoryStore();
+	    Uri userUrl = new Uri("http://user.example.com/");
+
+	    string[] cases = 
+		{ "", 
+		  "http://not.in.a.link.tag/",
+		  "<link rel=\"openid.server\" href=\"not.in.html.or.head\" />"
+		};
+
+	    Fetcher fetcher;
+	    Consumer consumer;
+	    foreach (string userPage in cases)
+	    {
+		fetcher = new TestFetcher(userUrl, userPage, null);
+		consumer = new Consumer(store, fetcher);
+		try {
+		    consumer.BeginAuth(userUrl);
+		    TestTools.Assert(false, String.Format("Shouldn't have succeeded with user_page=[{0}]", userPage));
+		}
+		catch (ParseException e) {}
+		
+	    }
+	}
+
+
+	class TestConsumer : Consumer
+	{
+	    static string CONSUMER_X = @"x/a0BNdiZWTdmJDCgDrjsPZFtIOaSMEi16u0W5LkExC3L+GHPbnJkFu/jjRTZXp5Lb7Q6FdaAonAgdpFRQbo7I8XdHrdCulFuz9+hv0mn5eqGamB27MosGZcZaNwhSNyTT6KY4DEpwX6ohlRxbofZWT7CFNAzUW8ike3/N/OgTA=";
+
+	    static string CONSUMER_SPUB = @"AMwsoRFdgWDxtKRX40foZBCtnd50JT7+/MZcp6g3BNlwzz+4DN7eI5XQaqF52OKkDZPIy/2L/7PVAMhYxotXFHWyLprWoDELijzy6JmlqYDwK1UOmNqdzWo/mH+0PREjt1FbQfkda1YXcy10vLuFWfiIMHhCHew+uq9E9D8ErUEu";
+
+	    static string CONSUMER_ENC_MAC_KEY = @"/8e7cN5TYwWibiKdvlhgx/q3Zq0=";
+
+	    public TestConsumer (IAssociationStore store, Fetcher fetcher) : base (store, fetcher)
+	    {
+	    }
+	    
+	    public Association TestParseAssociation()
+	    {
+		NameValueCollection results = new NameValueCollection();
+		results.Add("assoc_type", "HMAC-SHA1"); 
+		results.Add("assoc_handle", "myhandle");
+		results.Add("session_type", "DH-SHA1");
+		results.Add("dh_server_public", CONSUMER_SPUB);
+		results.Add("enc_mac_key", CONSUMER_ENC_MAC_KEY);
+		results.Add("expires_in", "600");
+
+		DiffieHellman dh = new DiffieHellmanManaged(CryptUtil.DEFAULT_MOD, CryptUtil.DEFAULT_GEN, Convert.FromBase64String(CONSUMER_X));
+		return ParseAssociation(results, dh, new Uri("http://www.google.com/"));
+	    }
+	}
+
+	class DumbStore : IAssociationStore
+	{
+	    public DumbStore()
+	    {
+	    }
+	    
+	    public byte[] AuthKey
+	    {
+		get { throw new NotImplementedException(); }
+	    }
+	    
+	    public bool IsDumb
+	    {
+		get { return true; }
+	    }
+
+	    public void StoreAssociation(Uri serverUri, Association assoc)
+	    {
+	    }
+	    
+	    public Association GetAssociation(Uri serverUri)
+	    {
+		throw new NotImplementedException();
+	    }
+	    
+	    public Association GetAssociation(Uri serverUri, string handle)
+	    {
+		throw new NotImplementedException();
+	    }
+	    
+	    public bool RemoveAssociation(Uri serverUri, string handle)
+	    {
+		throw new NotImplementedException();
+	    }
+	    
+	    public void StoreNonce(string nonce)
+	    {
+		throw new NotImplementedException();
+	    }
+	    
+	    public bool UseNonce(string nonce)
+	    {
+		throw new NotImplementedException();
+	    }
+	}
+
+	static string SERVER_SECRET = @"Md7XQVWxUOidZXpGWVmHFgKYqZs=";
+
+	[Test]
+	public void ParseAssociation()
+	{
+	    IAssociationStore store = new DumbStore();
+	    TestConsumer consumer = new TestConsumer(store, new SimpleFetcher()); 
+	    Association assoc = consumer.TestParseAssociation();
+	    if (assoc == null)
+	    {
+		TestTools.Assert(false, "TestParseAssociation return a null association");
+	    }
+	    else
+	    {
+		string result = CryptUtil.ToBase64String(assoc.Secret);
+		TestTools.Assert(SERVER_SECRET == result, result);
+	    }
+	}
+    }
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Fetchers.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Fetchers.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Fetchers.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Fetchers.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,333 @@
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading;
+
+using Janrain.TestHarness;
+using Janrain.OpenId.Consumer;
+
+namespace OpenIdTest.OpenId
+{
+    class TestHttpHandler
+    {
+	static string CRLF = "\r\n";
+	static string SERVER_LINE = "Server: OpenId TestHttpServer\r\n";
+	//    Socket sock;
+	NetworkStream stream;
+	StreamWriter writer;
+	StreamReader reader;
+
+	enum Method {
+	    GET,
+	    POST
+	}
+
+	class Case
+	{
+	    public readonly int code;
+	    public readonly string redir;
+
+	    public Case( int code,
+			 string redir )
+	    {
+		this.code = code;
+		this.redir = redir;
+	    }
+	}
+
+	static Hashtable cases;
+
+	static TestHttpHandler()
+	{
+	    cases = new Hashtable();
+	    cases.Add("/success", new Case(200, null));
+	    cases.Add("/301redirect", new Case(301, "/success"));
+	    cases.Add("/302redirect", new Case(302, "/success"));
+	    cases.Add("/303redirect", new Case(303, "/success"));
+	    cases.Add("/307redirect", new Case(307, "/success"));
+	    cases.Add("/notfound", new Case(404, null));
+	    cases.Add("/badreq", new Case(400, null));
+	    cases.Add("/forbidden", new Case(403, null));
+	    cases.Add("/error", new Case(500, null));
+	    cases.Add("/server_error", new Case(503, null));
+	}
+    
+
+	public TestHttpHandler ( Socket sock )
+	{
+	    //this.sock = sock;
+	    this.stream = new NetworkStream(sock);
+	    this.writer = new StreamWriter(this.stream, Encoding.UTF8);
+	    this.reader = new StreamReader(this.stream, Encoding.ASCII);
+	}
+
+	public void ProcessRequest ()
+	{
+	    string headerLine = this.reader.ReadLine();
+	    string[] parts = headerLine.Split();
+	    string methodStr = parts[0];
+	    
+	    Method method;
+	    switch (methodStr)
+	    {
+	    case "GET":
+		method = Method.GET;
+		break;
+	    case "POST":
+		method = Method.POST;
+		break;
+	    default:
+		Error(501, new NameValueCollection());
+		return;
+	    }
+
+	    string path = parts[1];
+	    NameValueCollection headers = new NameValueCollection();
+	    // Consume rest of headers
+	    while(true)
+	    {
+		headerLine = this.reader.ReadLine();
+		if(headerLine.Equals(CRLF) || headerLine.Equals(""))
+		    break;
+		parts = headerLine.Split(":".ToCharArray());
+		headers[parts[0].Trim()] = parts[1].Trim();
+	    }
+
+	    if (method == Method.POST)
+	    {
+		string postBody = this.reader.ReadToEnd();
+	    }
+	    else
+	    {
+		Case cs;
+		if ((cs = (Case) cases[path]) != null)
+		{
+		    NameValueCollection extraHeaders = null;
+		    if (cs.redir != null)
+		    {
+			extraHeaders = new NameValueCollection();
+			string location = String.Format("http://localhost:9111{0}", cs.redir);
+			extraHeaders.Add("Location", location);
+		    }
+	  
+		    Respond(cs.code, "text/plain", path, extraHeaders);
+		}
+		else
+		{
+		    BadPath(path, methodStr, "Bad path");
+		}
+	    }
+	}
+
+	private void BadPath(string path, string method, string message)
+	{
+	    StringBuilder msg = new StringBuilder();
+	    msg.Append("Bad request:\r\n");
+	    msg.AppendFormat("HTTP method: {0}\r\n", method);
+	    msg.AppendFormat("path: {0}\r\n", path);
+	    if (message != null)
+		msg.AppendFormat("message: {0}\r\n", message);
+      
+	    Respond(400, "text/plain", msg.ToString(), null);
+	}
+
+	private void Error(int code, NameValueCollection headers)
+	{
+	    string contentType = "text/html" ;
+	    string bodyFmt = "<HTML>" + 
+		"<HEAD><TITLE>{0} {1}</TITLE></HEAD>" +
+		"<BODY>{0} {1}</BODY></HTML>";
+	    string body = String.Format(bodyFmt, code, 
+					((HttpStatusCode) code).ToString());
+	    Respond(code, contentType, body, headers);
+	}
+
+	private void Respond ( int code, string contentType, string content, NameValueCollection headers )
+	{
+	    string statusLine = String.Format("HTTP/1.1 {0} {1}{2}", code, ((HttpStatusCode) code).ToString(), CRLF);
+	    string contentTypeLine = "Content-type: " + contentType + CRLF;
+	    string contentLengthLine = String.Format("Content-Length: {0}{1}", content.Length, CRLF); 
+
+	    writer.Write(statusLine);
+	    writer.Write(SERVER_LINE);
+	    writer.Write(contentTypeLine);
+	    writer.Write(contentLengthLine);
+
+	    if (headers != null)
+	    {
+		foreach (string key in headers)
+		    writer.Write(String.Format("{0}: {1}{2}", key, headers[key], CRLF));
+	    }
+
+	    writer.Write(CRLF);
+	    writer.Write(content);
+	    writer.Flush();
+	}
+    }
+
+    class TestHttpServer
+    {
+	const int port = 9111;
+	TcpListener myListener;
+
+	public TestHttpServer ()
+	{
+	    myListener = new TcpListener(port);
+	    myListener.Start();
+	    Console.WriteLine("Web Server Running");
+	}
+
+	public void ServeForever ()
+	{
+	    TestHttpHandler handler;
+	    while(true)
+	    {
+		//Accept a new connection
+		Socket mySocket = myListener.AcceptSocket();
+		handler = new TestHttpHandler(mySocket);
+		try
+		{
+		    handler.ProcessRequest();
+		}
+		catch (Exception e)
+		{
+		    Console.Write(e.ToString());
+		}
+		finally
+		{
+		    mySocket.Close();
+		}
+	    }
+	}
+    }
+
+    [TestSuite]
+    public class FetcherTestSuite
+    {
+	struct Expected
+	{
+	    public readonly HttpStatusCode code;
+	    public readonly Uri final;
+	    public readonly string body;
+
+	    public Expected ( int code,
+			      Uri final,
+			      string body )
+	    {
+		this.code = (HttpStatusCode) code;
+		this.final = final;
+		this.body = body;
+	    }
+	    
+	    public void Test(FetchResponse actual)
+	    {
+		TestTools.Assert(actual.code == this.code);
+		TestTools.Assert(actual.finalUri.Equals(this.final));
+		TestTools.Assert(
+		    Encoding.GetEncoding(actual.charset).GetString(
+			actual.data) == this.body);
+	    }
+	}
+	    
+	struct Case
+	{
+	    public readonly Uri fetchUri;
+	    public readonly Expected expected;
+	    
+	    public Case ( string path,
+			  Expected expected )
+	    {
+		this.fetchUri = GetUrl(path);
+		this.expected = expected;
+	    }
+	}
+	
+	static Uri GetUrl(string path)
+	{
+	    return new Uri(String.Format("http://localhost:9111{0}", path));
+	}
+	
+	static Case Plain(string path, int code)
+	{
+	    path = "/" + path;
+	    return new Case(path, new Expected(code, GetUrl(path), path));
+	}
+	
+	static ArrayList cases;
+
+	static FetcherTestSuite ()
+	{
+	    cases = new ArrayList();
+            cases.Add(Plain("success", 200));
+            cases.Add(new Case("/301redirect", new Expected(
+				   200, GetUrl("/success"), "/success")));
+            cases.Add(new Case("/302redirect", new Expected(
+				   200, GetUrl("/success"), "/success")));
+            cases.Add(new Case("/303redirect", new Expected(
+				   200, GetUrl("/success"), "/success")));
+            cases.Add(new Case("/307redirect", new Expected(
+				   200, GetUrl("/success"), "/success")));
+	    cases.Add(Plain("notfound", 404));
+	    cases.Add(Plain("badreq", 400));
+	    cases.Add(Plain("forbidden", 403));
+	    cases.Add(Plain("error", 500));
+	    cases.Add(Plain("server_error", 503));
+	}
+
+	private static void WebserverThread()
+	{
+	    TestHttpServer server = new TestHttpServer();
+	    server.ServeForever();
+	}
+
+	private static void TestFetcher(Fetcher f)
+	{
+	    f.Get(new Uri("http://localhost:9111/success"));
+	    
+	    FetchResponse actual;
+	    foreach (Case c in cases)
+	    {
+		Console.Write("Fetching {0}...", c.fetchUri.ToString());
+		try
+		{
+		    try
+		    {
+			actual = f.Get(c.fetchUri);
+			c.expected.Test(actual);
+		    }
+		    catch (FetchException e) 
+		    {
+			c.expected.Test(e.response);
+		    }
+		    Console.Write("OK");
+		}
+		finally
+		{
+		    Console.WriteLine("");
+		}
+	    }
+	}
+
+	[Test]
+	public void Fetch ()
+	{
+	    Thread t = new Thread(new ThreadStart(WebserverThread));
+	    t.Start();
+	    try
+	    {
+		Thread.Sleep(0);
+		Fetcher f = new SimpleFetcher();
+		TestFetcher(f);
+	    }
+	    finally
+	    {
+		t.Abort();
+	    }
+	}
+    }
+
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Parse.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Parse.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Parse.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Consumer/Parse.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,575 @@
+using System;
+
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+using Janrain.TestHarness;
+using Janrain.OpenId;
+
+namespace OpenIdTest.OpenId 
+{
+    [TestSuite]
+    public class LinkParserTestSuite
+    {
+        ArrayList failures;
+        ArrayList exceptions;
+	static string delim = "\n\n";
+        
+	static object[] SplitCase(string s)
+	{
+	    ArrayList parts = new ArrayList();
+	    int start = 0;
+	    int match;
+	    
+	    while (start < s.Length)
+	    {
+		match = s.IndexOf(delim, start);
+		if (match < 0)
+		    break;
+		
+		parts.Add(s.Substring(start, match - start));
+		start = match + 2;
+	    }
+	    
+	    return parts.ToArray();
+	}
+
+        class Failure 
+        {
+            public string cs;
+            public NameValueCollection[] actual;
+            public NameValueCollection[] expected;
+            
+            public Failure(string cs, NameValueCollection[] expected, NameValueCollection[] actual)
+            {
+                this.cs = cs;
+                this.expected = expected;
+                this.actual = actual;
+            }
+        }
+
+        class Exc
+        {
+            public string cs;
+            public NameValueCollection[] expected;
+            public Exception exc;
+            
+            public Exc(string cs, NameValueCollection[] expected, Exception exc)
+            {
+                this.cs = cs;
+                this.expected= expected;
+                this.exc = exc;
+            }
+        }
+
+        private bool CheckDicts(NameValueCollection d1, NameValueCollection d2)
+        {
+            foreach (string key in d1)
+            {
+                if (d2[key] == null)
+                    return false;
+                
+                if (d2[key] != d2[key])
+                    return false;
+            }
+            return true;
+        }
+
+        private void Run(string cs, NameValueCollection[] expected)
+        {
+            byte[] csData = Encoding.UTF8.GetBytes(cs);
+            try 
+            {
+                NameValueCollection[] actual = LinkParser.ParseLinkAttrs(csData, csData.Length, "utf-8");
+
+                if (actual.Length != expected.Length)
+                {
+                    this.failures.Add(new Failure(cs, expected, actual));
+                    return;
+                }
+
+                for (uint i = 0; i < expected.Length; i++)
+                {
+                    if (! (CheckDicts(actual[i], expected[i]) && 
+                                CheckDicts(expected[i], actual[i])))
+                    {
+                        return;
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                exceptions.Add(new Exc(cs, expected, e));
+            }
+        }
+
+        private string Pretty(NameValueCollection[] input)
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("[");
+            foreach(NameValueCollection attrs in input)
+            {
+                sb.Append("{\n");
+                foreach(string key in attrs)
+                    sb.AppendFormat("  {0}: {1}\n", key, attrs[key]);
+                sb.Append("}");
+            }
+            sb.Append("]");
+            return sb.ToString();
+        }
+
+        private void CheckErrors()
+        {
+            foreach (Failure failure in failures)
+            {
+                Console.WriteLine("".PadRight(40, '='));
+                Console.WriteLine("FAILURE:");
+                Console.WriteLine("Case:");
+                Console.WriteLine("[{0}]", failure.cs);
+                Console.WriteLine("Expected:");
+                Console.WriteLine(Pretty(failure.expected));
+                Console.WriteLine("Actual:");
+                Console.WriteLine(Pretty(failure.actual));
+                Console.WriteLine("");
+            }
+
+            foreach (Exc e in exceptions)
+            {
+                Console.WriteLine("".PadRight(50, '='));
+                Console.WriteLine("FAILURE:");
+                Console.WriteLine("Case:");
+                Console.WriteLine("[{0}]", e.cs);
+                Console.WriteLine("Expected:");
+                Console.WriteLine(Pretty(e.expected));
+                Console.WriteLine("Exception:");
+                Console.WriteLine("[{0}]", e.exc.ToString());
+                Console.WriteLine("");
+            }
+
+            if (failures.Count > 0 || exceptions.Count> 0)
+                TestTools.Assert(false, "some of the parse tests failed");
+        }
+
+        
+        static string no_match_cases_str = @"
+            <link>
+
+            <html>
+            <link>
+
+            <head>
+            <link>
+
+            <html>
+            <head>
+            </head>
+            <link>
+
+            <html>
+            <link>
+            <head>
+
+            <link>
+            <html>
+            <head>
+
+            <html>
+            <head>
+            </head>
+            </html>
+            <link>
+
+            <html>
+            <head>
+            <html>
+            <link>
+
+            <head>
+            <html>
+            <link>
+
+            <html>
+            <head>
+            <body>
+            <link>
+
+            <html>
+            <head>
+            <head>
+            <link>
+
+            <html>
+            <head>
+            <script>
+            <link>
+            </script>
+
+            <html>
+            <head>
+            <!--
+            <link>
+            -->
+
+            <html>
+            <head>
+            <![CDATA[
+            <link>
+            ]]>
+
+            <html>
+            <head>
+            <![cDaTa[
+            <link>
+            ]]>
+
+            <htmlx>
+            <head>
+            <link>
+
+            <html:summer>
+            <head>
+            <link>
+
+            <html>
+            <head:zucchini>
+            <link>
+
+            <html/>
+            <head>
+            <link>
+
+            <html/>
+            <html>
+            <head>
+            <link>
+
+            <html>
+            <head/>
+            <link>
+
+            <html>
+            <head/>
+            <head>
+            <link>";
+
+        [Test]
+        public void NoMatch()
+        {
+            failures = new ArrayList();
+            exceptions= new ArrayList();
+            uint i = 0;
+            foreach (string cs in SplitCase(no_match_cases_str))
+            {
+                Run(cs, new NameValueCollection[]{});
+                i++;
+            }
+            CheckErrors();
+        }
+        
+        
+        static string empty_link_cases_str = @"
+            <!-- Plain vanilla -->
+            <html>
+            <head>
+            <link>
+
+            <!-- Ignore tags in the <script:... > namespace -->
+            <html>
+            <head>
+            <script:paddypan>
+            <link>
+            </script:paddypan>
+
+            <!-- Short link tag -->
+            <html>
+            <head>
+            <link/>
+
+            <!-- Spaces in the HTML tag -->
+            <html >
+            <head>
+            <link>
+
+            <!-- Spaces in the head tag -->
+            <html>
+            <head >
+            <link>
+
+            <html>
+            <head>
+            <link >
+
+            <html><head><link>
+
+            <html>
+            <head>
+            <link>
+            </head>
+
+            <html>
+            <head>
+            <link>
+            </head>
+            <link>
+
+            <html>
+            <head>
+            <link>
+            <body>
+            <link>
+
+            <html>
+            <head>
+            <link>
+            </html>
+
+            <html>
+            <head>
+            <link>
+            </html>
+            <link>
+
+            <html>
+            <delicata>
+            <head>
+            <title>
+            <link>
+
+            <HtMl>
+            <hEaD>
+            <LiNk>
+
+            <butternut>
+            <html>
+            <summer>
+            <head>
+            <turban>
+            <link>
+
+            <html>
+            <head>
+            <script>
+            <link>
+
+            <html><head><script><link>
+
+            <html>
+            <head>
+            <!--
+            <link>
+
+            <html>
+            <head>
+            <![CDATA[
+            <link>
+
+            <html>
+            <head>
+            <![ACORN[
+            <link>
+            ]]>
+
+            <html>
+            <head>
+            <link>
+            -->";
+
+        [Test]
+        public void EmptyLink()
+        {
+            failures = new ArrayList();
+            exceptions= new ArrayList();
+            NameValueCollection[] expected = new NameValueCollection[] {new NameValueCollection()};
+            foreach (string cs in SplitCase(empty_link_cases_str))
+                Run(cs, expected);
+
+            CheckErrors();
+        }
+
+        static string two_link_cases_str = @"
+            <html>
+            <head>
+            <link>
+            <link>
+
+            <html>
+            <gold nugget>
+            <head>
+            <link>
+            <link>
+
+            <html>
+            <head>
+            <link>
+            <LiNk>
+            <body>
+            <link>
+            ";
+
+        [Test]
+        public void TwoLink()
+        {
+            failures = new ArrayList();
+            exceptions= new ArrayList();
+            NameValueCollection[] expected = new NameValueCollection[] {
+		new NameValueCollection(), new NameValueCollection()};
+            
+            foreach (string cs in SplitCase(two_link_cases_str))
+                Run(cs, expected);
+
+            CheckErrors();
+        }
+        
+        static string attr_cases_str = @"
+            <html><head><link rel=openid.server>
+
+            <html><head><link rel=openid.server/>
+
+            <html><head><link rel=openid.server />
+
+            <html><head><link hubbard rel=openid.server>
+
+            <html><head><link hubbard rel=openid.server/>
+
+            <html><head><link hubbard rel=openid.server />
+
+            <html><head><link / rel=openid.server>
+
+            <html><head><link rel=""openid.server"">
+
+            <html><head><link rel='openid.server'>
+            ";
+
+        [Test]
+        public void Attr()
+        {
+            failures = new ArrayList();
+            exceptions= new ArrayList();
+            NameValueCollection attrs = new NameValueCollection();
+            attrs.Add("rel", "openid.server");
+            
+            foreach (string cs in SplitCase(attr_cases_str))
+                Run(cs, new NameValueCollection[]{attrs});
+
+            CheckErrors();
+        }
+
+        class Case
+        {
+            public string html;
+            public NameValueCollection[] expected;
+            public Case(string html, 
+                    params NameValueCollection[] expected)
+            {
+                this.html = html;
+                this.expected = expected;
+            }
+        }
+
+        private static NameValueCollection NewDict(params string[] input)
+        {
+            NameValueCollection d = new NameValueCollection();
+            for (uint i = 0; i < (input.Length/2); i++)
+                d.Add(input[2*i], input[2*i+1]);
+            return d;
+        }
+
+        static Case[] cases = new Case[] { new Case(
+                "<html><head><link x=y><link a=b>", 
+                NewDict("x", "y"),
+                NewDict("a", "b")),
+            new Case("<html><head><link x=&y>", 
+                    NewDict("x", "&y")),
+            new Case("<html><head><link x=\"&y\">", 
+                    NewDict("x", "&y")),
+            new Case("<html><head><link x=\"&amp;\">", 
+                    NewDict("x", "&")),
+            new Case("<html><head><link x=\"&#26;\">", 
+                    NewDict("x", "&#26;")),
+            new Case("<html><head><link x=\"&lt;\">", 
+                    NewDict("x", "<")),
+            new Case("<html><head><link x=\"&gt;\">", 
+                    NewDict("x", ">")),
+            new Case("<html><head><link x=\"&quot;\">", 
+                    NewDict("x", "\"")),
+            new Case("<html><head><link x=\"&amp;&quot;\">", 
+                    NewDict("x", "&\"")),
+            new Case("<html><head><link x=\"&amp;&quot;&hellip;&gt;\">",
+                    NewDict("x", "&\"&hellip;>")),
+            new Case("<html><head><link x=\"x&amp;&quot;&hellip;&gt;x\">",
+                    NewDict("x", "x&\"&hellip;>x")),
+            new Case("<html><head><link x=y<>", 
+                    NewDict("x", "y")),
+            new Case("<html><head><link x=y<link x=y />",
+                    NewDict("x", "y"), 
+                    NewDict("x", "y")),
+            new Case("<html><head><link x=y<link x=y />",
+                    NewDict("x", "y"), 
+                    NewDict("x", "y")),
+            new Case("<html><head><link x=y y=><link x=y />",
+                    NewDict("x", "y"), 
+                    NewDict("x", "y")),
+            new Case("<html><head><link x=y", 
+                    NewDict("x", "y")),
+            new Case("<html><head><link x=\"<\">", 
+                    NewDict("x", "<")),
+            new Case("<html><head><link x=\">\">", 
+                    NewDict("x", ">")),
+            new Case("<html><head><link x=\"\u1234\">", 
+                    NewDict("x", "\u1234")),
+            new Case("<html><head><link x=\"\u1234&amp;\">",
+                    NewDict("x", "\u1234&")),
+            new Case("<html><head><link x=z x=y>",
+                    NewDict("x", "y")),
+            new Case("<html><head><link x=y x=y>",
+                    NewDict("x", "y")),
+            new Case("<html><head><link x=y y=z>",
+                    NewDict("x", "y", "y", "z")),
+            //The important examples:
+            // Well-formed link rel="openid.server"
+            new Case("<html><head><link rel=\"openid.server\" " +
+                    "href=\"http://www.myopenid.com/server\" />" +
+                    "</head></html>",
+                    NewDict("rel", "openid.server", "href", 
+                        "http://www.myopenid.com/server")),
+            // Well-formed link rel="openid.server" and "openid.delegate"
+            new Case("<html><head><link rel=\"openid.server\" " +
+                    "href=\"http://www.myopenid.com/server\" />" +
+                    "<link rel=\"openid.delegate\" href=\"http://example.myopenid.com/\" />" +
+                    "</head></html>",
+                    NewDict("rel", "openid.server", "href",
+                        "http://www.myopenid.com/server"),
+                    NewDict("rel", "openid.delegate", "href", 
+                        "http://example.myopenid.com/")),
+            // from brian's livejournal page
+            new Case(@"<!DOCTYPE html
+          PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN""
+                 ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
+                 <html xmlns=""http://www.w3.org/1999/xhtml"">
+                   <head>
+                     <link rel=""stylesheet"" href=""http://www.livejournal.com/~serotta/res/319998/stylesheet?1130478711"" type=""text/css"" />
+         <meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />
+ <meta name=""foaf:maker"" content=""foaf:mbox_sha1sum '12f8abdacb5b1a806711e23249da592c0d316260'"" />
+ <meta name=""robots"" content=""noindex, nofollow, noarchive"" />
+ <meta name=""googlebot"" content=""nosnippet"" />
+ <link rel=""openid.server"" href=""http://www.livejournal.com/openid/server.bml"" />
+                   <title>Brian</title>
+         </head>",
+         NewDict("rel", "stylesheet", "href", "http://www.livejournal.com/~serotta/res/319998/stylesheet?1130478711", "type", "text/css"),
+         NewDict("rel", "openid.server", "href", "http://www.livejournal.com/openid/server.bml"))
+        };
+        
+        [Test]
+        public void RealAttrs()
+        {
+            failures = new ArrayList();
+            exceptions= new ArrayList();
+
+            foreach (Case cs in cases)
+                Run(cs.html, cs.expected);
+
+            CheckErrors();
+        }
+    }
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Store/Generic.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Store/Generic.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Store/Generic.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Store/Generic.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,174 @@
+using System;
+using System.Text;
+using System.Threading;
+using System.Security.Cryptography;
+
+using Janrain.OpenId;
+using Janrain.OpenId.Store;
+
+using Janrain.TestHarness;
+
+namespace OpenIdTest.OpenId.Store
+{
+    public class StoreTester
+    {
+        IAssociationStore store;
+        static Uri SERVER_URL = new Uri("http://www.myopenid.com/openid");
+        static DateTime NOW = DateTime.UtcNow;
+        
+        
+        public StoreTester ( IAssociationStore store )
+        {
+            this.store = store;
+        }
+
+        public static Association GenAssociation ()
+        {
+            return GenAssociation(0, 600);
+        }
+
+        public static Association GenAssociation (int issued)
+        {
+            return GenAssociation(issued, 600);
+        }
+
+        public static Association GenAssociation (int issued, int lifetime)
+        {
+            byte[] secret = new byte[20];
+            (new RNGCryptoServiceProvider()).GetBytes(secret);
+            byte[] handle = new byte[128];
+            CryptUtil.RandomSelection(handle, 
+                    Encoding.ASCII.GetBytes("abcdefghijklmnopqrstuvwxyz" + 
+                        "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
+                        "0123456789"));
+
+            return new HMACSHA1Association(
+                    Encoding.ASCII.GetString(handle),
+                    secret,
+                    (NOW + new TimeSpan(0, 0, issued + lifetime)) - 
+                    DateTime.UtcNow);
+        }
+
+        public void CheckRetrieve ()
+        {
+            CheckRetrieve(null, null);
+        }
+        
+        public void CheckRetrieve ( string handle, 
+                                    Association expected )
+        {
+            Association retrieved = this.store.GetAssociation(SERVER_URL,
+                    handle);
+            if (expected == null || this.store.IsDumb)
+                TestTools.Assert(retrieved == null);
+            else
+                TestTools.Assert(retrieved.Equals(expected));
+        }
+
+        public void CheckRemove ( string handle,
+                                  bool expected )
+        {
+            CheckRemove(SERVER_URL, handle, expected);
+        }
+        
+        public void CheckRemove ( Uri serverUrl,
+                                  string handle,
+                                  bool expected )
+        {
+            bool present = this.store.RemoveAssociation(serverUrl, handle);
+            bool expectedPresent = (! this.store.IsDumb) && expected;
+            TestTools.Assert(((!expectedPresent) && (!present)) || 
+                    (expectedPresent && present));
+        }
+        
+
+        public void Test ()
+        {
+            Association assoc = GenAssociation();
+            // Make sure that a missing association returns no result
+            CheckRetrieve();
+
+            // Check that after storage, getting returns the same result
+            this.store.StoreAssociation(SERVER_URL, assoc);
+            CheckRetrieve(null, assoc);
+
+            // more than once
+            CheckRetrieve(null, assoc);
+            
+            // Storing more than once has no ill effect
+            this.store.StoreAssociation(SERVER_URL, assoc);
+            CheckRetrieve(null, assoc);
+            
+            // Removing an association that does not exist returns not present
+            CheckRemove(assoc.Handle + "x", false);
+
+            // Removing an association that does not exist returns not present
+            CheckRemove(
+                    new Uri(SERVER_URL.ToString() + "x"), assoc.Handle, false);
+    
+            // Removing an association that is present returns present
+            CheckRemove(assoc.Handle, true);
+            
+            // but not present on subsequent calls
+            CheckRemove(assoc.Handle, false);
+            
+            // Put assoc back in the this.store
+            this.store.StoreAssociation(SERVER_URL, assoc);
+            
+            // More recent and expires after assoc
+            Thread.Sleep(new TimeSpan(0, 0, 1));
+            Association assoc2 = GenAssociation(1);
+            this.store.StoreAssociation(SERVER_URL, assoc2);
+            
+            // After storing an association with a different handle, but the
+            // same , the handle with the later expiration is
+            // returned.
+            CheckRetrieve(null, assoc2);
+
+            // We can still retrieve the older association
+            CheckRetrieve(assoc.Handle, assoc);
+            
+            // Plus we can retrieve the association with the later expiration
+            // explicitly
+            CheckRetrieve(assoc2.Handle, assoc2);
+            
+            // More recent, but expires earlier than assoc2 or assoc
+            Thread.Sleep(new TimeSpan(0, 0, 1));
+            Association assoc3 = GenAssociation(2, 100);
+            this.store.StoreAssociation(SERVER_URL, assoc3);
+            
+            CheckRetrieve(null, assoc3);
+            CheckRetrieve(assoc.Handle, assoc);
+            CheckRetrieve(assoc2.Handle, assoc2);
+            CheckRetrieve(assoc3.Handle, assoc3);
+            
+            CheckRemove(assoc2.Handle, true);
+            
+            CheckRetrieve(null, assoc3);
+            CheckRetrieve(assoc.Handle, assoc);
+            CheckRetrieve(assoc2.Handle, null);
+            CheckRetrieve(assoc3.Handle, assoc3);
+            
+            CheckRemove(assoc2.Handle, false);
+            CheckRemove(assoc3.Handle, true);
+            
+            CheckRetrieve(null, assoc);
+            CheckRetrieve(assoc.Handle, assoc);
+            CheckRetrieve(assoc2.Handle, null);
+            CheckRetrieve(assoc3.Handle, null);
+            
+            CheckRemove(assoc2.Handle, false);
+            CheckRemove(assoc.Handle, true);
+            CheckRemove(assoc3.Handle, false);
+            
+            CheckRetrieve(null, null);
+            CheckRetrieve(assoc.Handle, null);
+            CheckRetrieve(assoc2.Handle, null);
+            CheckRetrieve(assoc3.Handle, null);
+            
+            CheckRemove(assoc2.Handle, false);
+            CheckRemove(assoc.Handle, false);
+            CheckRemove(assoc3.Handle, false);
+        }
+    }
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Store/MySqlStore.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Store/MySqlStore.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Store/MySqlStore.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId.Store/MySqlStore.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,51 @@
+using System;
+
+using ByteFX.Data.MySqlClient;
+
+using Janrain.TestHarness;
+using Janrain.OpenId.Store.MySql;
+
+using OpenIdTest.OpenId.Store;
+
+namespace OpenIdTest.OpenId.Store.MySql
+{
+    [TestSuite]
+    public class MySqlStoreTestSuite
+    {
+        [Test]
+        public void MySqlStore()
+        {
+            MySqlConnection connection = new MySqlConnection(
+                    "Server=localhost;" +
+                    "User ID=root;" +
+                    "Password=;");
+            connection.Open();
+
+            MySqlCommand cmd = connection.CreateCommand();
+            string sql = "DROP DATABASE openid_test;";
+            cmd.CommandText = sql;
+            try {
+                cmd.ExecuteNonQuery();
+            }
+            catch (MySqlException e)
+            { }
+            cmd.Dispose();
+
+            cmd = connection.CreateCommand();
+            cmd.CommandText = "CREATE DATABASE openid_test;";
+            cmd.ExecuteNonQuery();
+            cmd.Dispose();
+
+            cmd = connection.CreateCommand();
+            cmd.CommandText = "USE openid_test;";
+            cmd.ExecuteNonQuery();
+            cmd.Dispose();
+            
+            MySqlStore store = new MySqlStore(connection);
+            store.CreateTables();
+            StoreTester tester = new StoreTester(store);
+            tester.Test();
+        }
+    }
+    
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/Association.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/Association.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/Association.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/Association.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,30 @@
+using System;
+using System.Text;
+
+using Janrain.TestHarness;
+using Janrain.OpenId;
+
+namespace OpenIdTest.OpenId 
+{
+    [TestSuite]
+    public class HMACSHA1AssociationTestSuite
+    {
+	[Test]
+	public void SerializeDeserialize()
+	{
+	    TimeSpan expiresIn = new TimeSpan(0, 0, 600);
+	    string handle = "handle";
+	    byte[] secret = ASCIIEncoding.ASCII.GetBytes("secret");
+	    
+	    Association assoc = new HMACSHA1Association(
+	        handle, secret, expiresIn);
+
+	    byte[] s = assoc.Serialize();
+	    
+	    Association assoc2 = Association.Deserialize(s);
+
+	    TestTools.Assert(assoc.Equals(assoc2));
+	    TestTools.Assert(assoc.GetHashCode() == assoc2.GetHashCode());
+	}
+    }
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/DH.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/DH.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/DH.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/DH.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,57 @@
+using System;
+using System.IO;
+using System.Text;
+
+using Mono.Security.Cryptography;
+
+using Janrain.TestHarness;
+using Janrain.OpenId;
+
+namespace OpenIdTest.OpenId 
+{
+    [TestSuite]
+    public class DiffieHellmanTestSuite
+    {
+	private static string Test1()
+	{
+	    DiffieHellman dh1 = CryptUtil.CreateDiffieHellman();
+	    DiffieHellman dh2 = CryptUtil.CreateDiffieHellman();
+	    string secret1 = CryptUtil.ToBase64String(
+		dh1.DecryptKeyExchange(dh2.CreateKeyExchange()));
+	    string secret2 = CryptUtil.ToBase64String(
+		dh2.DecryptKeyExchange(dh1.CreateKeyExchange()));
+	    TestTools.Assert(secret1 == secret2);
+	    return secret1;
+	}
+	
+	[Test]
+	public void Test()
+	{
+	    string s1 = Test1();
+	    string s2 = Test1();
+	    TestTools.Assert(s1 != s2);
+	}
+
+	[Test]
+	public void TestPublic()
+	{
+	    StreamReader sr = new StreamReader(@"Tests/Janrain.OpenId/dhpriv");
+	    try
+	    {
+		String line;
+		while ( (line = sr.ReadLine()) != null )
+		{
+		    string[] parts = line.Trim().Split(new char[]{' '});
+		    byte[] x = Convert.FromBase64String(parts[0]);
+		    DiffieHellman dh = new DiffieHellmanManaged(CryptUtil.DEFAULT_MOD, CryptUtil.DEFAULT_GEN, x);
+		    string pub = CryptUtil.UnsignedToBase64(dh.CreateKeyExchange());
+		    TestTools.Assert(pub == parts[1]);
+		}
+	    }
+	    finally
+	    {
+		sr.Close();
+	    }
+	}
+    }
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/MemoryStore.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/MemoryStore.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/MemoryStore.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/MemoryStore.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,117 @@
+using System;
+using System.Collections;
+using System.Security.Cryptography;
+
+using Janrain.OpenId;
+using Janrain.OpenId.Store;
+
+namespace OpenIdTest.OpenId 
+{
+    class MemoryStore : IAssociationStore
+    {
+        Hashtable serverAssocs;
+        Hashtable nonces;
+        byte[] authKey = new byte[20];
+        
+        public MemoryStore()
+        {
+            this.serverAssocs = new Hashtable();
+            this.nonces = new Hashtable();
+            (new RNGCryptoServiceProvider()).GetBytes(this.authKey);
+        }
+        
+        public byte[] AuthKey
+        {
+            get { 
+                return (byte[]) this.authKey.Clone();
+            }
+        }
+
+        public bool IsDumb
+        {
+            get {
+                return false;
+            }
+        }
+
+        private ServerAssocs GetServerAssocs ( Uri serverUri )
+        {
+            if (serverAssocs[serverUri] == null)
+                serverAssocs.Add(serverUri, new ServerAssocs());
+            return (ServerAssocs) serverAssocs[serverUri];
+        }
+	
+        public void StoreAssociation ( Uri serverUri, 
+                                       Association assoc )
+        {
+            ServerAssocs assocs = GetServerAssocs(serverUri);
+            assocs.Set((Association)assoc.Clone());
+        }
+        
+        public Association GetAssociation ( Uri serverUri )
+        {
+            return GetServerAssocs(serverUri).Best();
+        }
+
+        public Association GetAssociation ( Uri serverUri, 
+                                            string handle )
+        {
+            return GetServerAssocs(serverUri).Get(handle);
+        }
+        
+        public bool RemoveAssociation ( Uri serverUri, 
+                                        string handle )
+        {
+            return GetServerAssocs(serverUri).Remove(handle);
+        }
+        
+        public void StoreNonce ( string nonce )
+        {
+            this.nonces[nonce] = 0;
+        }
+        
+        public bool UseNonce(string nonce)
+        {
+            bool ret = (this.nonces[nonce] != null);
+            this.nonces.Remove(nonce);
+            return ret;
+        }
+
+
+        class ServerAssocs
+        {
+            Hashtable assocs;
+            
+            public ServerAssocs ()
+            {
+                this.assocs = new Hashtable();
+            }
+            
+            public void Set ( Association assoc )
+            {
+                this.assocs.Add(assoc.Handle, assoc);
+            }
+            
+            public Association Get ( string handle )
+            {
+                return (Association) this.assocs[handle];
+            }
+            
+            public bool Remove ( string handle )
+            {
+                bool ret = (this.assocs[handle] == null);
+                this.assocs.Remove(handle);
+                return ret;
+            }
+            
+            public Association Best ()
+            {
+                Association best = null;
+                foreach (Association assoc in this.assocs.Values)
+                    if (best == null || best.Issued < assoc.Issued)
+                        best = assoc;
+                return best;
+            }
+        }
+    }
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/dhpriv
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/dhpriv?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/dhpriv (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Janrain.OpenId/Tests/Janrain.OpenId/dhpriv Wed Oct 11 15:24:51 2006
@@ -0,0 +1,29 @@
+ALoiAzCdasNc/t7MCd3BY7fTDx5qIVKWvYLryQ7Q3uNcNst3aoL9n6FQe1C206UinrA09ql2OROhMVX0kyATCRvoNKLEDM9zfGqqQIloMFMNy5X+0169UWhQy6V/0L6nKU7hRAgs3W8FUD5xijB3EM4zUxG3CPazdftlIvUr/R45 AMcX69rlxfc7lHnl1FY87FHf6U7KITe1gyuU1bPnIuAkaBiB0SOdRO7Uom2HY0uudFj6F14Q+/Th3DkaJ+lLDqH9Vm93OZ5YEHAmmMqlpOKzXUcU+9mz2d0ML4Nlr+yeMbmttlysrNgjvwozARCZvSqJ8haY0dK5xe9/LTOlJlqa
+AIL26kKBfCaXyXNgrtahVTPqY3DAW4iwkZHfEeWRV4EuHnCvNdG+2NHRXbjokKnR3+MfZZHrJXj+UzID6ce0DyhYIOMR59CP4fvEOydG3XVzTuIsDK2SqLAZd/8LDVe0jTRL0LKG4Ai3+4mdlDarFyHNRZ91VFTpPFomQS4mv/NT fXB3HGZWLUNc1WQzkHN7b1rTWC0rGqJvgPohU+CDnZrKU259i/8cEGFqGWMzL4ReR5bEV/LjbGFSUfa5TvrP8yHyRnQrQ3ZaGW0f1Wz6rJioODqoapQQK+AwgREsROZyCPw8KAjYLz1mDNRpLENg03vB5TKU9eNh3FZAJf5GBO8=
+AIbDYlOTUXENW4WFDkuTGzD+ae65BfcdnaKEMBgvL0bizGrG+0rf7fXtWPEEVBqGQ9h/hP/v0oTIV2rcjpweTmyP9GqIFRQv1pIFrIR03qnsWYXyA3Tw3JXBsKwgxAiyOiOuxj+T4rSHdObYT7BDa8jDPCIItF6wh7rROTu935Nj AMLcirsSlIwh/xKAzE7BJnUl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dWQAoDHjs2pt5oIDcLZWDSFYcPjvG2UIDKhISZBaY= ZkbvZn9vfsvM9uPDjGKtjDGTI+fvn66JJ4G/c3m0Ghs53wqoHBwmn4DpMfjdcrfy4JfaD6c39ESvFw9TOzDdmoRu3IT7gjnldCTCBzZ6QJWr+PraHLHhq3EAiqW49HB2Z3W1LLn0V1jT3BjUPTK6mo8psAutkEFHqdGz8Kk+xcA=
+Jl8XDwQrwjDWwRkz5laiYh4BhbS8odblZAWzdkThvuF1UKLCljrzx9i03mLTPdu9S7V3owlvIN7bVAx4x2yazcRpMTKjN948NKsfAQMuKvqMCgwCw3EaFW+yYmSujsEGWK5VSfFUQwiLuAw5B3E7L6UaNuihYc5e3wudNWO1egw= cl61la3SXlS3B6Wktl74VTZPRWJBhAf1ZnYxs3Rcm2+RgsbwsYdZVxoIYiQK4EgmHBxm2mGz0GC+rsCZtPpE46gxDL32djP5D1ZMGJYo3FgXu2AF7Nn38HcOaJHEqA+QcTnjkIvGUXulH5nMNAB0bgbY4xQhS5U5/4p2tXyz0Jw=

Added: incubator/heraldry/libraries/csharp/openid/trunk/Mono/Makefile
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Mono/Makefile?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Mono/Makefile (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Mono/Makefile Wed Oct 11 15:24:51 2006
@@ -0,0 +1,19 @@
+# -*- makefile -*-
+CSC=gmcs
+
+SOURCES=Mono.Math/BigInteger.cs \
+	Mono.Math.Prime/ConfidenceFactor.cs \
+	Mono.Math.Prime/PrimalityTests.cs \
+	Mono.Math.Prime.Generator/NextPrimeFinder.cs \
+	Mono.Math.Prime.Generator/PrimeGeneratorBase.cs \
+	Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs \
+	Mono.Security.Cryptography/DHKeyGeneration.cs \
+	Mono.Security.Cryptography/DHParameters.cs \
+	Mono.Security.Cryptography/DiffieHellman.cs \
+	Mono.Security.Cryptography/DiffieHellmanManaged.cs \
+	Mono.Xml/MiniParser.cs \
+	Mono.Xml/SecurityParser.cs
+
+
+DiffieHellman.dll: $(SOURCES)
+	$(CSC) -target:library -clscheck- -out:$@ -unsafe+ $(SOURCES)

Added: incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/NextPrimeFinder.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/NextPrimeFinder.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/NextPrimeFinder.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/NextPrimeFinder.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,55 @@
+//
+// Mono.Math.Prime.Generator.NextPrimeFinder.cs - Prime Generator
+//
+// Authors:
+//	Ben Maurer
+//
+// Copyright (c) 2003 Ben Maurer. All rights reserved
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Mono.Math.Prime.Generator {
+
+	/// <summary>
+	/// Finds the next prime after a given number.
+	/// </summary>
+#if INSIDE_CORLIB
+	internal
+#else
+	public
+#endif
+	class NextPrimeFinder : SequentialSearchPrimeGeneratorBase {
+		
+		protected override BigInteger GenerateSearchBase (int bits, object Context) 
+		{
+			if (Context == null) 
+				throw new ArgumentNullException ("Context");
+
+			BigInteger ret = new BigInteger ((BigInteger)Context);
+			ret.SetBit (0);
+			return ret;
+		}
+	}
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/PrimeGeneratorBase.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/PrimeGeneratorBase.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/PrimeGeneratorBase.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/PrimeGeneratorBase.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,75 @@
+//
+// Mono.Math.Prime.Generator.PrimeGeneratorBase.cs - Abstract Prime Generator
+//
+// Authors:
+//	Ben Maurer
+//
+// Copyright (c) 2003 Ben Maurer. All rights reserved
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Mono.Math.Prime.Generator {
+
+#if INSIDE_CORLIB
+	internal
+#else
+	public
+#endif
+	abstract class PrimeGeneratorBase {
+
+		public virtual ConfidenceFactor Confidence {
+			get {
+#if DEBUG
+				return ConfidenceFactor.ExtraLow;
+#else
+				return ConfidenceFactor.Medium;
+#endif
+			}
+		}
+
+		public virtual Prime.PrimalityTest PrimalityTest {
+			get {
+				return new Prime.PrimalityTest (PrimalityTests.RabinMillerTest);
+			}
+		}
+
+		public virtual int TrialDivisionBounds {
+			get { return 4000; }
+		}
+
+		/// <summary>
+		/// Performs primality tests on bi, assumes trial division has been done.
+		/// </summary>
+		/// <param name="bi">A BigInteger that has been subjected to and passed trial division</param>
+		/// <returns>False if bi is composite, true if it may be prime.</returns>
+		/// <remarks>The speed of this method is dependent on Confidence</remarks>
+		protected bool PostTrialDivisionTests (BigInteger bi)
+		{
+			return PrimalityTest (bi, this.Confidence);
+		}
+
+		public abstract BigInteger GenerateNewPrime (int bits);
+	}
+}

Added: incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs?view=auto&rev=463009
==============================================================================
--- incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs (added)
+++ incubator/heraldry/libraries/csharp/openid/trunk/Mono/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs Wed Oct 11 15:24:51 2006
@@ -0,0 +1,120 @@
+//
+// Mono.Math.Prime.Generator.SequentialSearchPrimeGeneratorBase.cs - Prime Generator
+//
+// Authors:
+//	Ben Maurer
+//
+// Copyright (c) 2003 Ben Maurer. All rights reserved
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Mono.Math.Prime.Generator {
+
+#if INSIDE_CORLIB
+	internal
+#else
+	public
+#endif
+	class SequentialSearchPrimeGeneratorBase : PrimeGeneratorBase {
+
+		protected virtual BigInteger GenerateSearchBase (int bits, object context)
+		{
+			BigInteger ret = BigInteger.GenerateRandom (bits);
+			ret.SetBit (0);
+			return ret;
+		}
+
+
+		public override BigInteger GenerateNewPrime (int bits)
+		{
+			return GenerateNewPrime (bits, null);
+		}
+
+
+		public virtual BigInteger GenerateNewPrime (int bits, object context)
+		{
+			//
+			// STEP 1. Find a place to do a sequential search
+			//
+			BigInteger curVal = GenerateSearchBase (bits, context);
+
+			const uint primeProd1 = 3u* 5u * 7u * 11u * 13u * 17u * 19u * 23u * 29u;
+
+			uint pMod1 = curVal % primeProd1;
+
+			int DivisionBound = TrialDivisionBounds;
+			uint[] SmallPrimes = BigInteger.smallPrimes;
+			//
+			// STEP 2. Search for primes
+			//
+			while (true) {
+
+				//
+				// STEP 2.1 Sieve out numbers divisible by the first 9 primes
+				//
+				if (pMod1 %  3 == 0) goto biNotPrime;
+				if (pMod1 %  5 == 0) goto biNotPrime;
+				if (pMod1 %  7 == 0) goto biNotPrime;
+				if (pMod1 % 11 == 0) goto biNotPrime;
+				if (pMod1 % 13 == 0) goto biNotPrime;
+				if (pMod1 % 17 == 0) goto biNotPrime;
+				if (pMod1 % 19 == 0) goto biNotPrime;
+				if (pMod1 % 23 == 0) goto biNotPrime;
+				if (pMod1 % 29 == 0) goto biNotPrime;
+
+				//
+				// STEP 2.2 Sieve out all numbers divisible by the primes <= DivisionBound
+				//
+				for (int p = 10; p < SmallPrimes.Length && SmallPrimes [p] <= DivisionBound; p++) {
+					if (curVal % SmallPrimes [p] == 0)
+						goto biNotPrime;
+				}
+
+				//
+				// STEP 2.3 Is the potential prime acceptable?
+				//
+				if (!IsPrimeAcceptable (curVal, context))
+					goto biNotPrime;
+
+				//
+				// STEP 2.4 Filter out all primes that pass this step with a primality test
+				//
+				if (PrimalityTest (curVal, Confidence))
+					return curVal;
+
+				//
+				// STEP 2.4
+				//
+			biNotPrime:
+				pMod1 += 2;
+				if (pMod1 >= primeProd1)
+					pMod1 -= primeProd1;
+				curVal.Incr2 ();
+			}
+		}
+
+		protected virtual bool IsPrimeAcceptable (BigInteger bi, object context)
+		{
+			return true;
+		}
+	}
+}



Mime
View raw message