(转载自“数字金刚的专栏”)
创建PVK文件[私人密匙文件]
makecert -sk DigitalTitan DigitalTitan.pvk
makecert -n CN=TelStar TelStar
创建CER文件[公司证书]
makecert -sk DigitalTitan.pvk TelStar.cer
创建SPC测试软件出版商证明书
cert2spc root.cer TelStar.cer TelStar.spc
创建INF文件
[version]
signature="$CHINA$"
AdvancedINF=2.0
[Add.Code]
WebOffice.ocx=WebOffice.ocx
mfc70.dll=mfc70.dll
msvcrt.dll=msvcrt.dll
olepro32.dll=olepro32.dll
[mfc70.dll]
file-win32-x86=thiscab
FileVersion=7,0,9466,0
DestDir=11
RegisterServer=yes
[msvcrt.dll]
file-win32-x86=thiscab
FileVersion=6,1,9844,0
DestDir=11
RegisterServer=yes
[olepro32.dll]
file-win32-x86=thiscab
FileVersion=5,0,4522,0
DestDir=11
RegisterServer=yes
[WebOffice.ocx]
file-win32-x86=thiscab
clsid={05430EC0-69CA-437A-B1F9-4B78B8647BEA}
FileVersion=1,0,0,1
RegisterServer=yes
;
创建CAB文件
cabarc -s 6144 n WebOffice.cab msvcrt.dll msvcp70.dll msvcr70.dll mfc70.dll olepro32.dll ASYCFILT.DLL STDOLE2.TLB WebOffice.ocx WebOffice.inf
使用Code Signing Wizard签署一个CAB文件
SIGNCODE.exe
时间戳服务:verisign的时间服务器,这个是免费的.
http://timestamp.verisign.com/scripts/timstamp.dll
另:
makeCert -sk DigitalTitanKey -n "CN=TelStar" -ss TelStar TelStar.cer
makecert -is TelStar -ic TelStar.cer -ss TelStarCompany.cer
Cert2SPC MyCert.cer MyCert.spc
打包工具包:
申请证书:Win2000:控制面板-管理工具-证书颁发机构[没有则更新组件]Http://127.0.0.1/CertSrv/
签名工具包:http://download.microsoft.com/download/b/e/f/bef2551b-401d-4311-ab8f-13d3892b8154/codesigningx86.exe
时间戳服务:verisign的时间服务器,这个是免费的.
http://timestamp.verisign.com/scripts/timstamp.dll
注意:如果基于MFC选择了静态编译就不需要配置动态运行库.
完成后编辑网页ActiveX.htm
<object id=DWebOffice style="left: 0px; width: 100%; top: 0px; height: 450px;" classid="clsid:05430EC0-69CA-437A-B1F9-4B78B8647BEA" viewastext codebase="http://127.0.0.1:9000/ActiveX/WebOffice.cab#version=1,0,0,3">
注意网页中object标签codebase参数的URL地址和#version所指定的版本号