如何为我的插件实现自定义数字签名?

发布于 2024-11-10 18:03:20 字数 288 浏览 4 评论 0原文

在 C++ 应用程序(实际上是一个浏览器插件,但这不太相关)中,我需要它能够运行通过 IPC 公开特定接口的外部进程。有点像插件架构,但插件是离散的应用程序,而不是 DLL 等。

有人可以轻松找到所需的接口并编写恶意“插件”,将其托管在他们的网站上,与恶意 SWF 相当,只是 SWF 是沙箱。然后,如果安装了浏览器插件的人访问该页面,它就会以一种路过式攻击的方式加载并运行恶意进程。

我看到的一个建议是使用签名机制,但我不知道如何实现这一点。请注意,我不是为大众市场而是为专业用途创建一些东西,因此生产合法插件的公司数量会很少。

In a C++ application (actually a browser plugin but this isn't too relevant) I have a need for it to be able to run external processes which expose a specific interface through IPC. Sort of like a plugin architecture but the plugins are discrete applications rather than DLLs, etc.

Someone can easily find out the required interface and write a malicious 'plugin', hosting it on their web-site, comparable to a malicious SWF except SWFs are sand-boxed. Then if someone with the browser-plugin installed comes to that page, it would load and run the malicious process in a kind of drive-by attack.

One recommendation I see is to use a signing mechanism, but I don't know how that might be achieved. Note, I'm not creating something for mass-market but specialist use, so the number of companies producing legitimate plugins would be small.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

睡美人的小仙女 2024-11-17 18:03:20

一种方法是使用 GPG 或 OpenSSL 等加密库。使用它们,您可以创建一个公钥/私钥对。您使用私钥签署您的应用程序。浏览器插件包含公钥,用于验证签名。这些库并不是特别容易使用。从 OpenSSL 包中读取例如 dgst.c。您需要将其(至少是验证部分)调整为您的插件。有很多API需要学习!您可以按原样使用 dgst.c 来签署文件。

如果您使用的是 Windows,您也可以以大致相同的方式使用 Windows Crypto API (CAPI),但我对 Windows API 几乎一无所知。

另一种方法是从头开始实现签名算法。这也不适合胆小的人。阅读 http://en.wikipedia.org/wiki/Digital_signature,选择一种如下所示的方法易于实现(RSA、DSA、ElGamal...),并实现它(签名和验证部分,或者只是验证部分 - 但然后确保它与 OpenSSL 或 GPG 兼容,以便您可以将它们用于签署。

One way is to use a cryptographic library like GPG or OpenSSL. With both of them you create a public/private key pair. You sign your application with the private key. The browser plugin contains the public key, which is used to verify the signature. These libraries are not particularly easy to use. Read e.g. dgst.c from the OpenSSL package. You will need to adapt it (at least the verification part) to your plugin. There's a lot of APIs to learn! You may use dgst.c as is to sign the files.

If you are on Windows you can also use windows Crypto API (CAPI) in much the same way, but I know next to nothing about Windows APIs.

Another way is to implement a signature algorithm from scratch. This is not for the faint of heart either. Read http://en.wikipedia.org/wiki/Digital_signature, pick a method that looks like easy to implement (RSA, DSA, ElGamal...), and implement it (both the signing and the verifying part, or just the verifying part -- but then make sure it is compatible with OpenSSL or GPG so you can use them for signing.

一抹淡然 2024-11-17 18:03:20

DLL 和 EXE 均使用 Authenticode 技术和 X.509 证书进行签名。

要使用 Windows 内置的机制验证 Windows 上的 Authenticode 签名,您可以使用 WinVerifyTrust 函数。这将要求每个“插件”都使用某个知名 CA(至少 Windows 已知)颁发的证书进行签名。

如果您想为插件开发人员提供自己的证书(让他们节省从 CA 购买证书的费用),那么您可以使用 PKIBlackbox 包我们的 SecureBlackbox 产品并成为您自己的证书颁发机构。 PKIBlackbox 还允许您创建和验证 Authenticode 签名。

Both DLLs and EXE are signed using Authenticode technology and X.509 certificates.

To validate the Authenticode signature on Windows using mechanisms built into Windows you use WinVerifyTrust function of CryptoAPI. This will require that each "plugin" is signed using the certificate issued by some well-known CA (known to Windows, at least).

If you want to give plugin developers your own certificates (to let them save money on purchasing certificates from CAs), then you can take PKIBlackbox package of our SecureBlackbox product and become your own certificate authority. PKIBlackbox allows you to create and verify Authenticode signatures as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文