Platform SDK: IIS SDK |
The ClientCertificate collection holds fields of keys and values from a security certificate that the client browser passes to the Web server. These fields are specified in the X.509 version 3 standard for public key certificates. Because X.509 is not an official standard, you may notice differences among certificates obtained from certification authorities. For more information, see the X509 Certificate article on the World Wide Web Consortium Web site.
In order to populate the fields of the ClientCertificate collection, both the Web server and the client browser must support the SSL3.0/PCT1.0 protocol. The Web site must have secure sockets layer (SSL) enabled and request client certificates. After SSL is enabled, the URL of the Web site will start with "https://" instead of "http://". The client browser must be capable of sending a certificate. If no certificate is sent, the ClientCertificate collection returns EMPTY.
You must configure your Web server to request client certificates.To read the values in each field of the ClientCertificate collection, pass in a key name and optional subfield name.
As a security precaution, always encode certificate data (or any request data) before using it. A general method of encoding data is to use Server.HTMLEncode. Another method is to write a short function that tests request data for invalid characters. More information can be found by reading chapter 12 of Writing Secure Code, and using Checklist: ASP Security when you create your ASP applications.
Request.ClientCertificate( Key[SubField] )
Value | Meaning |
---|---|
Certificate | A string containing the binary stream of the entire certificate content in ASN.1 format. This is useful to discover if special SubFields are present that are not listed below. |
Flags | A set of flags that provides additional client certificate information. If Flags is set to 1, a client certificate is present. If Flags is set to 2, the last certificate in this chain is from an unknown issuer. |
Issuer | A string that contains a list of subfield values containing information about the issuer of the certificate. If this value is specified without a SubField, the ClientCertificate collection returns a comma-separated list of subfields. For example, C=US, O=Verisign, and so on. |
SerialNumber | A string that contains the certification serial number as an ASCII representation of hexadecimal bytes separated by hyphens (-). For example, 04-67-F3-02. |
Subject | A string that contains a list of subfield values. The subfield values contain information about the subject of the certificate. If this value is specified without a SubField, the ClientCertificate collection returns a comma-separated list of subfields. For example, C=US, O=Msft, and so on. |
ValidFrom | A date specifying when the certificate becomes valid. This date follows VBScript format and varies with international settings. For example, in the United States, 9/26/96 11:59:59 P.M.. The year value is displayed as a four-digit number. |
ValidUntil | A date specifying when the certificate expires. The year value is displayed as a four-digit number. |
Value | Meaning |
---|---|
C | Specifies the name of the country/region of origin. |
CN | Specifies the common name of the user. (This subfield is only used with the Subject key.) |
GN | Specifies a given name. |
I | Specifies a set of initials. |
L | Specifies a locality. |
O | Specifies the company or organization name. |
OU | Specifies the name of the organizational unit. |
S | Specifies a state or province. |
T | Specifies the title of the person or organization. |
SubField values other than those listed in the preceding table can be identified by their ASN.1 object identifier (OID). The format of the Object Identifier is a list of numbers separated by a period (.). A list of Object Identifiers for your certificate can be obtained from the authority that issued your certificate.
You can iterate through the keys of the ClientCertificate collection, as shown in the following example.
<%
For Each strKey in Request.ClientCertificate
Response.Write strkey & " =index.html " & Request.ClientCertificate(strkey) & "<BR>"
Next
%>
The following example retrieves the common name of the company that issued the client certificate.
<%=index.html Request.ClientCertificate("IssuerCN") %>
The following example displays the expiration date of the client certificate.
This certification will expire on
<%=index.html Request.ClientCertificate("ValidUntil") %>
The following example uses the Flags key to test whether the issuer of the certificate is known.
<%
Const ceCertPresent =index.html 1
Const ceUnrecognizedIssuer = 2
If Request.ClientCertificate("Flags") = ceUnrecognizedIssuer Then
Response.Write "Unrecognized issuer"
End If
%>
The following example displays all the fields of a client certificate.
Issuer: <%=Request.ClientCertificate("Issuer")%><br>
Subject: <%=Request.ClientCertificate("Subject")%><br>
<% cer=Request.ClientCertificate("Certificate") %>
Certificate Raw Data: <%=cer%><br>
Certificate length: <%=len(cer)%><br>
Certificate Hex Data:
<% For x=1 To 100 %>
<%=hex(asc(mid(cer,x,1)))%>nbsp;
<% Next %>
Platforms: Windows 2000 with IIS 5.0 installed,
Windows XP with IIS 5.1 installed,
Windows Server 2003 family with IIS 6.0 installed
What did you think of this topic? |
Order a Platform SDK CD |
Questions:
Dear Friends, We are developing a system that needs to use a Brazilian e-CPF Client Certificate. In this system we need to extrac e-mail information from SubjectAlternativeName of the e-CPF Client Certificate. When we use the following code, we can read many fields of the certificate as showed as follow, but e-mail information resides into SubjectAlternativeName of the e-CPF Client Certificate and it does not appear clearly using this solution. Can anyone help me with this problem? Regards Robson Machado EXAMPLE OF USED CODE for each item in request.clientcertificate response.write item & " --> " & cstr(request.clientcertificate(item)) & "+
" next PUBLICKEY --> ????????????????????????????????????????????????????????????????????aA -------------------------------------------------------------------------------- VALIDFROM --> 14/5/2004 -------------------------------------------------------------------------------- ISSUEROU --> Secretaria da Receita Federal - SRF -------------------------------------------------------------------------------- ENCODING --> 1 -------------------------------------------------------------------------------- ISSUERCN --> AC CertiSign SRF -------------------------------------------------------------------------------- SERIALNUMBER --> 7d-91-72-93-e0-c9-c8-32-d9-3f-dc-a7-ba-ad-c6-7a -------------------------------------------------------------------------------- SUBJECT --> O=ICP-Brasil, OU=SRF e-CPF, OU=Secretaria da Receita Federal-SRF, C=BR, CN=ROBSON CARVALHO MACHADO:37585177100 -------------------------------------------------------------------------------- SUBJECTC --> BR -------------------------------------------------------------------------------- SUBJECTCN --> ROBSON CARVALHO MACHADO:37585177100 -------------------------------------------------------------------------------- CERTIFICATE --> ?????A??????????????c??????????????????????????????????????????????????????????????????????????????????????????????????l?????????????????»??????????????????????????????????ca?????????????????????????????????????????????????????????????????????aA??????????????´?????????????????????????????O?????????????????????????????????????0?????????????????????????????????????????????????????????????????????a?¯????”?????????????A?????????????????????????????????C????C?????C?c?????C??????????????????????c??a-?????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????BINARYSUBJECT --> MIGQMRMwEQYDVQQKFApJQ1AtQnJhc2lsMRIwEAYDVQQLFAlTUkYgZS1DUEYxKjAoBgNVBAsTIVNlY3JldGFyaWEgZGEgUmVjZWl0YSBGZWRlcmFsLVNSRjELMAkGA1UEBhMCQlIxLDAqBgNVBAMTI1JPQlNPTiBDQVJWQUxITyBNQUNIQURPOjM3NTg1MTc3MTAw -------------------------------------------------------------------------------- SUBJECTO --> ICP-Brasil -------------------------------------------------------------------------------- SUBJECTOU --> SRF e-CPF;Secretaria da Receita Federal-SRF -------------------------------------------------------------------------------- VALIDUNTIL --> 14/5/2005 23:59:59
file: /Techref/language/asp/OBJ/ref_vbom_reqoccc.htm, 14KB, , updated: 2004/11/16 15:48, local time: 2024/11/25 00:32,
3.145.155.149:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/language/asp/OBJ/ref_vbom_reqoccc.htm"> Request.ClientCertificate Collection</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.