如果你能赋予可信用户透明地访问加密网站的权限,岂不是很好?这样的话,每当这些用户在进入你的站点的时候,就不必总是需
要输入他们的用户名和口令了。用户可以同你的网站上的加密部分进行通信,而无须提供用户名和口令的一个方法是,在配置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)。现在cert.tx将应该包含
客户证书内容,如清单2所示。将清单2的内容拷贝到你喜爱的文本编辑器中,并保存到文件。