如何以编程方式从Excel中的VBA宏中删除数字签名

如何以编程方式从Excel中的VBA宏中删除数字签名

本文介绍了如何以编程方式从Excel中的VBA宏中删除数字签名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法以编程方式从Excel工作表的VBA宏中删除数字签名?



代码相当于进入VBA编辑器,进入工具菜单 - >数字签名并单击删除。

解决方案

有趣的问题。
出于安全考虑,故意不是Excel对象模型的一部分。



可以从证书存储中删除证书。这需要Win32 api调用(可以从VB6或VBA创建,但是我不知道在执行此操作后对项目的确切影响...
它肯定会使证书无效,但是我不会知道是否删除它
此外,您可能不希望从商店中删除证书(因为您可以将其用于其他内容)。



要查看证书库,请在运行提示符下键入 certmgr.msc



无论如何以编程方式删除证书的链接。 br>



要求:

1.您需要下载相应平台的Windows SDK才能获得capicom dll,+ regsvr32他们
2.您需要从要删除的证书中提取公钥。

3.首先使用不重要的工作簿进行测试,我没有想法这个方法是否(除了使证书无效)也会导致工作簿中的损坏。希望有人比这更好的建议。


Is there any way to programmatically remove the digital signature from the VBA macros of an Excel sheet?

i.e. code that is equivalent to entering the VBA editor, going to Tools menu -> Digital Signature and clicking Remove.

解决方案

Interesting question.It's deliberately not part of the Excel object model for security reasons.

It is possible to remove the certificate from the certificate store. This requires Win32 api calls (which can be made from VB6 or VBA but I'm not sure of the exact effect on your project once you do this...It will definately invalidate the certificate, but I don't know if it will remove it.Also you may not wish to remove the certificate from the store (since you could be using it for something else).

To view the certificate store, type, certmgr.msc at the Run prompt.

anyway a link on how to remove a certificate programmatically.
KB article showing how to remove a trusted root certificate from the store.

Requirements:
1. You'll need to download the Windows SDK for the appropriate platform to get the capicom dll's, + regsvr32 them2. You'll need to extract the public key from the certifcate you want to remove.
3. Test with a uninmportant workbook first, I have no idea whether this method will (apart from invalidating the certificate) also cause corruption in the workbook. Hopefully someone has a better suggestion than this.

这篇关于如何以编程方式从Excel中的VBA宏中删除数字签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 07:57