Certificate parsing with C#
Back in year 2000 I started using ASP and the ”Request.ClientCertificate Collection” described here.
Link to an old ASP page behind the login requirement of this site – Here
At that time I thought I was really cool doing smart card logon to a web site with certificate parsing. Back in those days anyone who could spell ”smart card” had a lot of marked attention.
But at the same time Windows 2000 was released (launched to retail on 17 February 2000) introducing ”Smart Card Logon” to Windows itself. But that feature intruduced the certificate field ”Subject Alternative Name” containing UPN for the certificate holder, for example ”firstname.lastname@example.org”. I thought spelling out the name of an application in the certificates was a horrible thing to do (company.com is the name of the ”application” Active Directory within Company Inc.)
However, Microsoft didn’t listen and I wanted to parse ”UPN” from the certificate in my ASP code. But since I’m just a copy-paste-programmer I never figured out how to do it with ”Request.ClientCertificate Collection”. Guess it’s not supported and the conversion from the binary format retreived with ”RequestClientCertificate(”Certificate”) was not that easy.
But now with some C# I finally got it working:
(requires that you have a certificate trusted for login to service.secmaker.com)