Classic ASP program display .cer file’s information

I have a classic ASP application which can download the .cer file, now it needs to display the common name and issuer under the download link. So I try<%=theCert.SubjectCN%>, <%=theCert.IssuerCN%> and <%= Request.ClientCertificate("IssuerCN") %>. However they both cannot display the value.

<% dim fs,uploadFilePath,uploadPath, theCert %>
<% set fs=Server.CreateObject("Scripting.FileSystemObject")
theCert=uploadFilePath & uploadPath & "\" & "appCert.cer" %>
<% if (fs.FileExists(server.mappath(uploadFilePath & uploadPath & "\" & "appCert.cer"))) then %>
<a href="<%=uploadFilePath & uploadPath & "\" & "appCert.cer"%>">appCert.cer</a> <!-- click the link to download the .cer file-->
<br />
Common Name: <%=theCert.SubjectCN%> <!-- does not show the common name -->
<br />
Issuer: <%=theCert.IssuerCN%> <!-- does not show the issuer -->
<br />
<%= Request.ClientCertificate("IssuerCN") %> <!-- other try to display IssuerCN  but does not show-->
<%else
the appCert.cer does not exist
end if 
%>  

About the .cer file, I do a research on the Internet and get confuse whether the .cer file is x.509 certificate or not because when I open it in notepad and find it looks like MIIFtDCCBJygAwIBAgIULS2ojxxTN+ (very long text).

In that case may I know how to display the common name and the issuer’s value? I try to display those values but not successful, may I seek your advice about the issue please. Thank you.

  • Where did you get this information or are you just randomly trying stuff? The File object in Scripting.FileSystemObject does not have a SubjectCN property. You want to try Request.ServerVariables("CERT_ISSUER").

    – 




Leave a Comment