如果你能賦予可信用戶透明地訪問加密網站的權限,豈不是很好?這樣的話,每當這些用戶在進入你的站點的時候,就不必總是需 要輸入他們的用戶名和口令了。用戶可以同你的網站上的加密部分進行通信,而無須提供用戶名和口令的一個方法是,在配置IIS (Internet Information Server,互連網信息服務器)要求質詢/響應認證之后,在Windows NT系統上使用IE瀏覽器。但如果你 的用戶使用的并不是NT系統或IE瀏覽器,那又該怎么辦呢?答案就是:使用Microsoft Certificate Server(微軟證書服務 器)。
Certificate Server 是 NT 4.0 Option Pack 的組成部分之一,它使你能夠為那些身份驗證合格的用戶生成并發放數字證書, 從而使他們在登錄站點時可以不必提供身份證明就可以訪問自己的NT用戶帳號。
數字證書對于網絡的安全性非常重要。數字證書實際上是一份電子文檔,計算機系統可以利用它來確定和驗證那些正在瀏覽網絡, 收發電子郵件和傳輸文件的用戶的身份。獲取數字證書的一條途徑是通過證書權威。這些機構通過核實用戶的身份而向他們或他們 的系統頒發證書。證書服務器(Certificate Server)讓你充當企業內部的證書權威的角色,使你能夠保護員工的機密性,削減 開支并提高服務質量。(想獲得關于證書權威和數字證書的背景信息,請參閱1997年10月期上Tao Zhou的文章"You Can Be a Web Certification Authority")
Certificate Server 安裝程序將提示為服務器創建一個SSL (Secure Sockets Layer,安全套接層) 密匙。SSL 服務器密匙允 許網絡服務器和客戶瀏覽器進行安全加密的會話。如果沒有SSL 密匙, IIS 4.0將無法使用基于證書的客戶驗證。在Create New Key(創建新密匙)對話框中通過選擇"Automatically send the request to an online authority(自動將申請發送到某在 線權威)"選項,你可以一次生成并簽名SSL服務器密匙請求,如屏幕3所示。
現在,你必須把你剛創建的CA增加到服務器的可信CA列表中去。通過在你的瀏覽器中安裝服務器密匙可以做到這點。為此,啟動服 務器上的IE 4.0 ,瀏覽站點http://server name/certsrv/certenroll/cacerts.htm。標題為Certificate Authority Certificate List 的網頁將會出現,并將列出你剛生成的CA密匙。點擊此連接并選擇"Open this file from its current location(在當前位置打開此文件)",你將看到安裝New Site Certificate(新站點證書)的提示,如屏幕4所示。
<head> <title>Client Certificate Capture</title> </head> <body> <% 'Instantiate the ASP FileSystemObject in order 'to create a text file Set fs = Server.CreateObject("Scripting.FileSystemObject")
'Create text file using append mode Set outStream = fs.OpenTextFile( "C:/Inetpub/wwwroot/certificates/cert.txt", 8, True )
'Save certificate issuer information to text file outStream.WriteLine( "# Issuer: " & Request.ClientCertificate("Issuer") )
'Extract certificate subject (user) and account information 'from certificate su = Request.ClientCertificate( "Subject" ) mx = len(su) for x = 1 to mx if mid(su,x,1)=chr(10) or mid(su,x,1)=chr(13) then su=left(su,x-1)+";"+right(su,mx-x) end if next outStream.WriteLine( "# Subject: " & su ) outStream.WriteLine( "# Account: " & Request.ServerVariables("REMOTE_USER") )
'Extract encrypted certificate text from certificate; encode text as 64-bit data uue = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
for x = 1 to lcer step 3 a1 = asc(mid(cer,x,1)) if x+1 <= lcer then a2 = asc(mid(cer,x+1,1)) if x+2 <=lcer then a3 = asc(mid(cer,x+2,1)) else a3 = 0 end if else a2 = 0 a3 = 0 end if outStream.Write mid(uue, (a1 and 252)/4 +1 ,1) outStream.Write mid(uue, (a1 and 3)*16 + (a2 and 240)/16 +1 ,1) if x+1 <= lcer then outStream.Write mid(uue, (a2 and 15)*4 + (a3 and 192)/64 +1 ,1) if x+2 <= lcer then outStream.Write mid(uue, (a3 and 63) +1 ,1) else outStream.Write "=" end if else outStream.Write "==" end if l = l +4 if l = 64 then outStream.WriteLine("") l = 0 end if next if l > 0 then outStream.WriteLine( "" ) end if outStream.WriteLine( "-----END CERTIFICATE-----" )
Response.Write "Your certificate information has been received and logged successfully <br>" Response.Write "You will be notified when we have configured your secured access to this Site " %>
如果客戶瀏覽此ASP文件時,而沒有客戶證書顯示在客戶驗證窗口內,則可能是IIS元數據庫中的CA信息出了問題。要解決此問題, 重新在IIS根目錄下運行上文提到的三個命令(Iisca, NET STOP iisadmin /y,和 NET START w3svc)?,F在cert.tx將應該包含 客戶證書內容,如清單2所示。將清單2的內容拷貝到你喜愛的文本編輯器中,并保存到文件。