折雨的天空
ocx,dll打包成cab,并签名
2018-5-14 我好笨


拿到一个接口提供商的ocx是几个独立的dll,有inf文件,于是需要研究怎么打包成cab给浏览器使用



参考文档:



https://my.oschina.net/thismyhome/blog/127320



http://www.cnblogs.com/rushoooooo/archive/2011/06/22/2087542.html



https://www.cnblogs.com/weixing/archive/2013/05/06/3063083.html



https://blog.csdn.net/envon123/article/details/76681337







文档中cab的制作教程可行,但是签名就是不对的了,特别是上面参考中的几个







下面介绍遇到的问题:







cab的制作的话,之前搜的教程用什么特别的工具,没有生成成功,删除了。通过上面网址:



https://blog.csdn.net/envon123/article/details/76681337这个里面的iexpress就是可以的。







然后就是签名了。签名需要用到工具,见附件:






Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation。保留所有权利。

C:\Windows\system32>iexpress

C:\Windows\system32>signtool
'signtool' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Windows\system32>d:

D:\>cd GuangdongShebaoOcx

D:\GuangdongShebaoOcx>cd SignTool

D:\GuangdongShebaoOcx\SignTool>signtool.exe signwizard
SignTool Error: Invalid command: signwizard
Usage: signtool <command> [options]

Valid commands:
sign -- Sign files using an embedded signature.
timestamp -- Timestamp previously-signed files.
verify -- Verify embedded or catalog signatures.
catdb -- Modify a catalog database.
remove -- Reduce the size of an embedded signed file.

For help on a specific command, enter "signtool <command> /?"

D:\GuangdongShebaoOcx\SignTool>sign sign
'sign' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

D:\GuangdongShebaoOcx\SignTool>signcode.exe sign
Error: There is more than one valid certificate in the my store
Error: Signing Failed. Result = 80092008, (-2146885624)

D:\GuangdongShebaoOcx\SignTool>cd ...

D:\GuangdongShebaoOcx\SignTool>cd ..

D:\GuangdongShebaoOcx>makecert -sk ActiveX ActiveX.pvk -n CN=****有限公司
'makecert' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

D:\GuangdongShebaoOcx>cd SignTool

D:\GuangdongShebaoOcx\SignTool>makecert -sk ActiveX ActiveX.pvk -n CN=*****有限公司
Succeeded

D:\GuangdongShebaoOcx\SignTool>makecert -sk ActiveX.pvk ActiveX.cer
Succeeded

D:\GuangdongShebaoOcx\SignTool>cert2spc ActiveX.cer ActiveX.spc
Succeeded

D:\GuangdongShebaoOcx\SignTool>dir
驱动器 D 中的卷是 新加卷
卷的序列号是 5C12-6C65

D:\GuangdongShebaoOcx\SignTool 的目录

2018/05/14 14:25 <DIR> .
2018/05/14 14:25 <DIR> ..
2018/05/14 14:25 459 ActiveX.cer
2018/05/14 14:24 460 ActiveX.pvk
2018/05/14 14:25 506 ActiveX.spc
2012/06/08 10:25 511,328 capicom.dll
1998/10/27 14:33 7,440 cert2spc.exe
1998/10/27 14:33 59,664 certmgr.exe
1998/10/27 14:33 15,632 chktrust.exe
2007/11/15 13:27 184,320 libnspr4.dll
2007/11/15 13:27 28,672 libplc4.dll
1998/10/27 14:33 14,608 makecat.exe
1998/10/27 14:33 32,528 makecert.exe
1998/10/27 14:33 10,000 makectl.exe
2016/01/21 10:06 238 Microsoft.Windows.Build.Signing.mssign32.dll.manifest
2016/01/21 10:06 238 Microsoft.Windows.Build.Signing.wintrust.dll.manifest
2016/01/21 10:06 73,832 mssign32.dll
2015/07/06 09:21 2,249 MS_XS.crt
2011/04/16 04:25 1,930 MS_xs_CT.crt
2017/06/27 16:53 1,904 MS_xs_DG.crt
2015/07/06 09:21 2,244 MS_xs_WS.crt
1998/10/27 14:33 55,568 setreg.exe
1998/10/27 14:33 25,872 signcode.exe
2016/01/21 10:06 302,184 signtool.exe
2016/01/21 10:06 723 signtool.exe.manifest
2016/02/15 10:23 2,300 startcross.cer
2016/03/25 15:35 2,280 startcross_cn.cer
2016/01/21 10:06 214,120 wintrust.dll
2016/10/11 11:32 229 wosign.bat
27 个文件 1,551,528 字节
2 个目录 72,984,326,144 可用字节

D:\GuangdongShebaoOcx\SignTool>signcode.exe

D:\GuangdongShebaoOcx\SignTool>signcode.exe

D:\GuangdongShebaoOcx\SignTool>signcode.exe

D:\GuangdongShebaoOcx\SignTool>signcode.exe

D:\GuangdongShebaoOcx\SignTool>makecert -sk ActiveX ActiveX.pvk -n CN=****有限公司 -$ "individual" -r
Succeeded

D:\GuangdongShebaoOcx\SignTool>signcode.exe

--------------------------------------------上面是失败的-------------------------------------------------------------------------

D:\GuangdongShebaoOcx\SignTool>makecert -ss gdsfz -n "CN=*****科技有限公司" -sv d:\gdsfz.pvk -r d:\gdsfz.cer -$ "individual" -r
Succeeded

D:\GuangdongShebaoOcx\SignTool>cert2spc d:\gdsfz.cer d:\gdsfz.spc
Succeeded

D:\GuangdongShebaoOcx\SignTool>signcode.exe

D:\GuangdongShebaoOcx\SignTool>






注意分割线,最上面那个方法是失败的,最后这个生成的证书才可用,并且singcode的向导里要选择md5,而非其他教程里的sha1.







重要的是这句,综合了csdn上有个朋友发的:










makecert -ss gdsfz -n "CN=*****科技有限公司" -sv d:\gdsfz.pvk -r d:\gdsfz.cer -$ "individual" -r



https://bbs.csdn.net/topics/390516639 这个地址的底部回复。










最后cab签名成功了,但是没调用成功。







附件,签名工具:







SignTool.rar

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容