[Mono-list] ssl client authentication

nelson nelson <kascote@gmail.com>
Thu, 31 Mar 2005 13:53:29 -0300


Hi,
I setup an apache (2.0.53) with mod_mono (1.0.6) and mono (1.1.5) and
configure a directory to request a Certificate over SSL. That work ok.
When generate a page with this code [1], the page don't shown the
certificate data for the session, and when add this code [2], show all
the certificate variables, but the CERT_XXX variables are empty.
I want to verify the certificate credentials against a db and permit
access to diferent options, but can't access the certificate data :(.
Is something i'm doint wrong ?...

[1]
http://support.microsoft.com/kb/315588/EN-US/
---8<--------------------------------------------------------------------------------
void Page_Load(xxxx)
{
string userName;
userName = User.Identity.Name;
greetingLabel.Text = "Welcome " + userName;
HttpClientCertificate cert = Request.ClientCertificate;
if (cert.IsPresent)
    certDataLabel.Text = cert.Get("SUBJECT O");
else
    certDataLabel.Text="No certificate was found.";
}
---8<--------------------------------------------------------------------------------


[2]
---8<--------------------------------------------------------------------------------
int loop1, loop2;
NameValueCollection coll;
 
// Load ServerVariable collection into NameValueCollection object.
coll=Request.ServerVariables; 
// Get names of all keys into a string array. 
String[] arr1 = coll.AllKeys; 
for (loop1 = 0; loop1 < arr1.Length; loop1++) 
{
   Response.Write("Key: " + arr1[loop1] + "<br>");
   String[] arr2=coll.GetValues(arr1[loop1]);
   for (loop2 = 0; loop2 < arr2.Length; loop2++) {
      Response.Write("Value " + loop2 + ": " +
Server.HtmlEncode(arr2[loop2]) + "<br>");
   }
}
---8<--------------------------------------------------------------------------------

TIA
-- 
:: Nelson ::