<span id="Label3"></p><p><p>1. self-built Root Certificate</p></p> <p><p>Makecert-r-pe-n "cn=webssltestroot"-b 12/22/2013-e 12/23/2024-ss ROOT-SR localmachine-len 2048</p></p> <p><p></p></p> <p><p>2, the establishment of the website with the certificate</p></p> <p><p>Makecert-pe-n "cn=www.aaa.com"-b 12/22/2013-e 12/23/2024-eku 1.3.6.1.5.5.7.3.1-is root-ir localmachine-in WebSSLTe Stroot-len 2048-ss WEBHOSTING-SR LocalMachine</p></p> <p><p>CN is the domain name of the website</p></p> <p><p>3. Build client Certificate</p></p> <p><p>Makecert-pe-n "cn=czcz1024"-eku 1.3.6.1.5.5.7.3.2-is root-ir localmachine-in webssltestroot-ss my-sr currentuser- Len 2048</p></p> <p><p>CN can be a user name</p></p> <p><p>Root certificates on the local computer-trusted root certification authorities</p></p> <p><p>The Web site certificate is hosted on the local Computer-web</p></p> <p><p>Client certificates in the current user-personal</p></p> <p><p></p></p> <p><p>In iis, the web hosting Web site is established</p></p> <p><p>Use ie, access, when the client has a certificate test, will ask to select a certificate</p></p> <p><p></p></p> <pre class="code"><pre class="code"><span style="background: white; color: blue"></span><span style="background: white; color: black">r;</span> <span style="background: white; color: #2b91af"></span> <span style="background: white; color: black">cert = request.clientcertificate;</span> <span style="background: white; color: blue"></span> <span style="background: white; color: black">(cert. IsPresent) </span><span style="background: white; color: #a31515"></span><span style="background: white; color: black">+ cert. Subject;</span> <span style="background: white; color: blue">Else </span> <span style="background: white; color: black"></span> <span style="background: white; color: #a31515">"No certificate was found."</span> <span style="background: white; color: black">;</span> <span style="background: white; color: blue"></span> <span style="background: white; color: black">Content (r);</span></pre></pre><p><p>We can get the certificate information through the Code.</p></p><p><p></p></p><p><p></p></p><p><p></p></p><p><p>4, The program automatically create a user client certificate</p></p><pre class="code"><span style="background: white; color: blue"><span style="background: white; color: blue">var</span></span><span style="background: white; color: black"><span style="background: white; color: black">Path =</span></span><span style="background: white; color: #a31515"><span style="background: white; color: #a31515">@ "... \makecert.exe"</span></span><span style="background: white; color: black"><span style="background: white; color: black">;</span></span><span style="background: white; color: blue"><span style="background: white; color: blue">var</span></span><span style="background: white; color: black"><span style="background: white; color: black">cmd =</span></span><span style="background: white; color: #a31515"><span style="background: white; color: #a31515">"-pe-n</span></span><span style="background: white; color: #ff007f"><span style="background: white; color: #ff007f">\"</span></span><span style="background: white; color: #a31515"><span style="background: white; color: #a31515">cn=czcz1024</span></span><span style="background: white; color: #ff007f"><span style="background: white; color: #ff007f">\" </span></span><span style="background: white; color: #a31515"><span style="background: white; color: #a31515">-eku 1.3.6.1.5.5.7.3.2-is root-ir localmachine-in webssltestroot-ss my-sr currentuser-len 2048 "</span></span><span style="background: white; color: black"><span style="background: white; color: black">;</span></span><span style="background: white; color: blue"><span style="background: white; color: blue">var</span></span><span style="background: white; color: black"><span style="background: white; color: black">p =</span></span><span style="background: white; color: #2b91af"><span style="background: white; color: #2b91af">Process</span></span><span style="background: white; color: black"><span style="background: white; color: black">. Start (path, cmd);p. WaitForExit (); P.close ();</span></span></pre><p><p>Call cmd to execute, requires IIS to run administrator identity</p></p><p><p></p></p><p><p>5, export, and provide customer download</p></p><pre class="code"><span style="background: white; color: #2b91af"><span style="background: white; color: #2b91af">X509store</span></span><span style="background: white; color: black"><span style="background: white; color: black">store =</span></span><span style="background: white; color: blue"><span style="background: white; color: blue">New</span></span><span style="background: white; color: #2b91af"><span style="background: white; color: #2b91af">X509store</span></span><span style="background: white; color: black"><span style="background: white; color: black">(</span></span><span style="background: white; color: #2b91af"><span style="background: white; color: #2b91af">StoreName</span></span><span style="background: white; color: black"><span style="background: white; color: black">. My,</span></span><span style="background: white; color: #2b91af"><span style="background: white; color: #2b91af">storelocation</span></span><span style="background: white; color: black"><span style="background: white; color: black">. CurrentUser); Store. Open (</span></span><span style="background: white; color: #2b91af"><span style="background: white; color: #2b91af">Openflags</span></span><span style="background: white; color: black"><span style="background: white; color: black">. maxallowed);</span></span><span style="background: white; color: blue"><span style="background: white; color: blue">foreach</span></span><span style="background: white; color: black"><span style="background: white; color: black">(</span></span><span style="background: white; color: #2b91af"><span style="background: white; color: #2b91af">X509Certificate2</span></span><span style="background: white; color: black"><span style="background: white; color: black">Myx509certificate2</span></span><span style="background: white; color: blue"><span style="background: white; color: blue">inch</span></span><span style="background: white; color: black"><span style="background: white; color: black">Store. certificates) {</span></span><span style="background: white; color: blue"><span style="background: white; color: blue">if</span></span><span style="background: white; color: black"><span style="background: white; color: black">(myx509certificate2.subject = =</span></span><span style="background: white; color: #a31515"><span style="background: white; color: #a31515">"cn=czcz1024"</span></span><span style="background: white; color: black"><span style="background: white; color: black">) { </span></span><span style="background: white; color: blue"><span style="background: white; color: blue">byte</span></span><span style="background: white; color: black"><span style="background: white; color: black">[] certbyte = Myx509certificate2.export (</span></span><span style="background: white; color: #2b91af"><span style="background: white; color: #2b91af">X509contenttype</span></span><span style="background: white; color: black"><span style="background: white; color: black">. Pfx,</span></span><span style="background: white; color: #a31515"><span style="background: white; color: #a31515">"123456"</span></span><span style="background: white; color: black"><span style="background: white; color: black">); </span></span><span style="background: white; color: blue"><span style="background: white; color: blue">return</span></span><span style="background: white; color: black"><span style="background: white; color: black">File (certbyte,</span></span><span style="background: white; color: #a31515"><span style="background: white; color: #a31515">"application/octet-stream"</span></span><span style="background: white; color: black"><span style="background: white; color: black">, </span></span><span style="background: white; color: #a31515"><span style="background: white; color: #a31515">"cert.pfx"</span></span><span style="background: white; color: black"><span style="background: white; color: black">); }}</span></span><span style="background: white; color: blue"><span style="background: white; color: blue">return</span></span><span style="background: white; color: black"><span style="background: white; color: black">Content (</span></span><span style="background: white; color: #a31515"><span style="background: white; color: #a31515">"not found"</span></span><span style="background: white; color: black"><span style="background: white; color: black">);</span></span></pre><p><p>similarly, This also requires administrator to obtain</p></p><p><p>Need to export to pfx, the client can import, import, need a password, password for the code of "123456" that part</p></p><p><p>6. SSL Settings for IIS</p></p><p><p></p></p><p><p>If required, when the client does not have a certificate</p></p><p><p></p></p><p><p></p></p><p><p>When you select</p></p><p><p></p></p><p><p>No certificate is displayed</p></p><p><p></p></p><p><p>The Else branch that corresponds to the above code</p></p><p><p></p></p><p><p>Selecting Ignore will not require the client to provide the certificate</p></p><p><p></p></p><p><p>Built-in root, you need to import the root certificate to the trusted root when the client accesses</p></p><p><p>IIS HTTPS client certificate</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service