1 <!-- you need an updated XSP to handle this correctly -->
2 <%@ Page language="c#" %>
5 <script runat="server">
6 string GetValue (byte[] data)
8 if ((data == null) || (data.Length == 0))
10 return BitConverter.ToString (data);
13 void Page_Load (object sender, EventArgs e)
15 System.Text.StringBuilder sb = new System.Text.StringBuilder ();
16 HttpClientCertificate hcc = Request.ClientCertificate;
18 sb.Append ("Client certificate retrieved.");
19 sb.AppendFormat ("\n<br>BinaryIssuer: {0}", GetValue (hcc.BinaryIssuer));
20 sb.AppendFormat ("\n<br>CertEncoding: {0}", hcc.CertEncoding);
21 sb.AppendFormat ("\n<br>Certificate: {0}", GetValue (hcc.Certificate));
22 sb.AppendFormat ("\n<br>Cookie: {0}", hcc.Cookie);
23 sb.AppendFormat ("\n<br>Flags: {0}", hcc.Flags);
24 sb.AppendFormat ("\n<br>IsValid: {0}", hcc.IsValid);
25 sb.AppendFormat ("\n<br>KeySize: {0}", hcc.KeySize);
26 sb.AppendFormat ("\n<br>PublicKey: {0}", GetValue (hcc.PublicKey));
27 sb.AppendFormat ("\n<br>SecretKeySize: {0}", hcc.SecretKeySize);
28 sb.AppendFormat ("\n<br>SerialNumber: {0}", hcc.SerialNumber);
29 sb.AppendFormat ("\n<br>ServerIssuer: {0}", hcc.ServerIssuer);
30 sb.AppendFormat ("\n<br>ServerSubject: {0}", hcc.ServerSubject);
31 sb.AppendFormat ("\n<br>Subject: {0}", hcc.Subject);
32 sb.AppendFormat ("\n<br>ValidFrom: {0}", hcc.ValidFrom);
33 sb.AppendFormat ("\n<br>ValidUntil: {0}", hcc.ValidUntil);
35 System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate (hcc.Certificate);
36 sb.AppendFormat ("\n<br>X509Certificate: {0}", cert.ToString (true).Replace ("\n", "\n<br>"));
38 sb.Append ("No client certificate");
39 if (Request.IsSecureConnection) {
40 sb.Append (" was sent during negotiation.");
42 sb.Append (", and this can't work unless you use HTTPS!");
45 info.Text = sb.ToString ();
51 <asp:Label id="info" runat="server" />