|
Home > Archive > IIS Server > January 2005 > How to get client certificate from IIS?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to get client certificate from IIS?
|
|
| Jona Gold 2005-01-14, 7:51 am |
| I have a CGI application that should be able to read and store client
certificates. With CGI I see no way to do it, so I thought about
redirecting client to an ASP page where I have access to the
Request.ClientCertificate("Certificate") variable.
I wasn't able to get this variable with server-side JScript on IIS 5.1,
and in VBScript it doesn't work as described in documentation
(http://support.microsoft.com/kb/216829/EN-US/,
http://msdn.microsoft.com/library/d...bom_reqoccc.asp).
Provided examples are non-functional.
I must be missing a lot as it looks I'm the only one complaining about
it. Please give me a hint.
Regards,
Karel Miklav
| |
| Egbert Nierop \(MVP for IIS\) 2005-01-15, 5:49 pm |
| Did you set IIS as shown in picture?
If you don't it won't give you certificates.
Regards,
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm
"Jona Gold" <me@lurking.com> wrote in message
news:O8KtJsj%23EHA.3616@TK2MSFTNGP11.phx.gbl...
>I have a CGI application that should be able to read and store client
>certificates. With CGI I see no way to do it, so I thought about
>redirecting client to an ASP page where I have access to the
>Request.ClientCertificate("Certificate") variable.
>
> I wasn't able to get this variable with server-side JScript on IIS 5.1,
> and in VBScript it doesn't work as described in documentation
> (http://support.microsoft.com/kb/216829/EN-US/,
> http://msdn.microsoft.com/library/d...bom_reqoccc.asp).
> Provided examples are non-functional.
>
> I must be missing a lot as it looks I'm the only one complaining about it.
> Please give me a hint.
>
> Regards,
> Karel Miklav
| |
| Karel Miklav 2005-01-17, 2:47 am |
| Egbert Nierop (MVP for IIS) wrote:
> Did you set IIS as shown in picture?
> If you don't it won't give you certificates.
Yes, thanks Egbert, I get the certificate. It's just that in
ASP/VBScript I can't decode it properly from binary form and in
ASP/JScript I don't know what to do with the received object at all. I
have no problems in .NET/C#, but I'd prefer to have one simple file for
that as the rest of the application is CGI. Or be able to load the
certificate from CGI, if that's possible.
Here's a snip of my working C# piece:
private void Page_Load(object sender, System.EventArgs e)
{
byte[] content = Request.ClientCertificate.Certificate;
string certificate =
"-----BEGIN CERTIFICATE-----<br/>" +
wrap(System.Convert.ToBase64String(content), 64) + "<br/>" +
"-----END CERTIFICATE-----<br/>";
Response.Write(certificate);
}
--
Regards,
Karel Miklav
| |
| Egbert Nierop \(MVP for IIS\) 2005-01-28, 5:54 pm |
| "Karel Miklav" <karel@inetis.spppambait.com> wrote in message
news:csfn2502hcc@enews4.newsguy.com...
> Egbert Nierop (MVP for IIS) wrote:
>
> Yes, thanks Egbert, I get the certificate. It's just that in ASP/VBScript
> I can't decode it properly from binary form and in ASP/JScript I don't
> know what to do with the received object at all. I have no problems in
> .NET/C#, but I'd prefer to have one simple file for that as the rest of
> the application is CGI. Or be able to load the certificate from CGI, if
> that's possible.
>
> Here's a snip of my working C# piece:
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> byte[] content = Request.ClientCertificate.Certificate;
> string certificate =
> "-----BEGIN CERTIFICATE-----<br/>" +
> wrap(System.Convert.ToBase64String(content), 64) + "<br/>" +
> "-----END CERTIFICATE-----<br/>";
>
> Response.Write(certificate);
Sure I understand your problem now.
In ASP script you can't have binary arrays, only if you use external COM
components.
You could write one in C# and have it return a byte[] array which COM
interop will translate to a Variant of type VT_UI1 | VT_ARRAY
Another pure script solution (by using a tempory XML document)
http://p2p.wrox.com/topic.asp?TOPIC_ID=10298
|
|
|
|
|