使用程序集作为许可证文件的优点/缺点?

发布于 2024-08-19 05:45:08 字数 458 浏览 3 评论 0原文

我最初打算使用签名的序列化 xml 文件来存储许可证详细信息。 在规划中,越来越多的内容已转移到此“许可证文件”中,这将使我们能够分发单个应用程序并通过提供的许可证文件控制可用功能。

用户界面和打印报告与分销商徽标是联合品牌的,因此如果可以将其嵌入到许可证中就好了。我知道这可以通过序列化的 xml 文件来完成,但我想知道将此数据存储在已编译的程序集中有哪些优点和缺点?

许可证生成工具可以使用适当的属性和资源来编译程序集并对其进行签名。

更新
据我所知,使用序列化 xml 或程序集非常相似。从我的角度来看,程序集允许我添加其他资源,并为未来留下一些灵活性。一旦资源变得复杂,xml序列化就很痛苦。

更新2
该软件仅适用于我们的硬件,因此许可证安全性并不是一个大问题。主要目的是阻止临时用户启用他们未付费的功能。为了设计简单性,我会选择其中之一!

I was initially going to use a signed serialized xml file to store license details.
In planning, more and more has moved into this "license file" which will allow for us to distribute a single application and control available functions via the supplied license file.

The UI and printed reports are co-branded with distributors logos, so it would be good if this could be embedded into the license. I know this could be done with the serialized xml file but I was wondering what are the pros and cons of storing this data in a compiled assembly?

The license generation tool could compile the assembly with the appropriate properties and resources and sign it.

Update
From what I can see, using serialized xml or an assembly would be pretty similar. From my point of view, assemblies would allow me to add other resources and leaves some flexibility for the future. As soon as the resources get complicated, xml serialization is a pain.

Update2
The software only works with our hardware so licence security is not a massive concern. The main aim is to stop the casual user from enabling features that they have not paid for. I would be choosing one over the other for design simplicity!

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

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

发布评论

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

评论(6

玩物 2024-08-26 05:45:08

签名的 xml 许可证文件没有什么优点,但它们可能不适用于您的情况:

  1. 您可以使用记事本或 Web 浏览器等简单工具检查其内容。如果您必须管理大量许可证并且花费了很多时间,则只需查看文件即可更轻松地检查许可证范围。即使客户也可以通过电话向您朗读其许可证中最重要的要点。
  2. 如果单个应用程序安装可以分配多个许可证(每个用户、每个功能等),则管理 xml 文件列表比动态加载程序集更容易。
  3. 创建客户端许可证创建工具更容易 ->应用程序将提交一个未签名的 xml 文件进行签名。
  4. 版本控制更容易。如果您的软件的新版本具有新的许可选项,并且旧的许可证应该适用于升级的版本,则根据您对签名许可程序集的实现,您可以破坏旧的软件。

如果您没有任何这些特定需求,请选择“程序集即许可证”选项,因为它更易于实施。

更新

查看我之后出现的其他答案 - 对本地计算机上运行的软件的完美保护不存在,并且很可能在很长一段时间内不存在。不要花费太多时间来保护您的软件,因为如果有人真的非常想免费使用它,他就会找到一种方法来做到这一点。让用户有更多理由使用您的应用程序并简化购买体验。

在 dll 或外部 xml 文件中签署许可证就足够了。

A signed xml license file has few advantages, but they may not be applicaple to your situation:

  1. You can inspect the contents of it using a simple tool like notepad or a web browser. If you have to manage a lot of licenses and a lot of time goes by, you can check the license scope more easily by simply viewing the file. Even the customer can read you the most important points of his license over the phone.
  2. If a single application installation can have many licenses assigned to it (per user, per function, etc), it is easier to manage a list of xml files, than to dynamically load assemblies.
  3. It is easier to create a tool for client-side license creation -> the application would submit an unsigned xml file for signing.
  4. It's easier for versioning. If a new version of your software has new licensing options, and the old license should work with the upgraded version, depending of your implementation of the singed licensing assembly, you can break the old software.

If you don't have any of these specific needs, go with the assembly-as-a-license option, as it's simpler to implement.

Update

Looking at other answers that popped up after mine - a perfect protection for software running on a local computer does not exist and will likely not exist for a very long time. Don't spend too much time on protecting your software, because if anyone really, really wants to use it for free, he will find a way to do so. Give the users more reasons to use your application and simplify the buying experience.

Going with signing the license in a dll or an external xml file is good enough.

苍风燃霜 2024-08-26 05:45:08

您可以使用程序集代替许可证文件,但您不应该这样做。始终可以从程序集中删除数字签名;现在使用 Reflexil 工具就很简单了。

有关更多详细信息,请参阅文章CAS 防篡改已损坏:软件许可的后果

You could use an assembly in lieu of a licence file, but you shouldn't. It has always been possible to remove the digital signing from an assembly; now it's trivial using the Reflexil tool.

See the article CAS Tamper-Proofing is Broken: Consequences for Software Licensing for more details.

乖乖公主 2024-08-26 05:45:08

一直对我有用的一个好的解决方案是创建一个许可证类,其中包含所需的所有属性,例如名称、到期时间、徽标等。将类序列化为内存中的二进制数据,然后对其进行加密并保存到文件中。这样做不需要签名,并且文件具有防黑客能力。要读取您的许可证,只需执行相反的操作:读取文件、解密、反序列化。对此需要注意的是,如果多个程序集要读取此许可证文件,则加密/解密函数应位于单独的共享程序集中。

A good solution that has always worked for me is to create a license class with all the properties needed such as name, expiration, logos and such. Serialize the class to binary data in memory, then encrypt that and save to a file. Doing it this way doesn't require signing and the file is hack resistant. To read your license simply do the reverse, read the file, unencrypt, unserialize. One caveat to this is that if multiple assemblies are going to read this license file, then the encrypt/unencrypt functions should be in a separate shared assembly.

走过海棠暮 2024-08-26 05:45:08

我不会使用程序集作为许可证文件 - 正如其他人指出的那样,破坏它相对微不足道。
我会使用一个文件(xml 或其他文件),然后将其锁定到用户计算机。这可以通过多种方式实现:
1)使用 System.Cryptography.ProtectedData - 这只是包装 Windows DPAPI 并使用 Windows 密钥存储(每个用户或每个本地计算机)。这是一种简单的方法,但您必须使用 Encoding.UTF8.GetString (或任何您的编码)从字节数组转换回来。这很简单,但不是工业强度,因为有人仍然可以挖出密钥库等。
2) 使用机器唯一 ID(例如具有对称算法(例如 Rijndael 或 Blowfish)的 SID,并提供未加密许可证文件的 SHA-256 哈希值作为 IV。这实现起来有点复杂,因为您需要使用 WMI 来查找 SID,然后使用 System.Security.Cryptography.RijndaelManaged 等来进行加密/解密。

I wouldn't go with using an assembly as a license file - as others have pointed out it's relatively trivial to break.
I would use a file ( xml or whatever ) then lock it to the users machine. This can be achieved in several ways :
1) Use System.Cryptography.ProtectedData - this just wraps the Windows DPAPI and uses the windows key store ( either per user or per local machine ). This a simple(ish) approach but you will have to using Encoding.UTF8.GetString ( or whatever your encoding is ) to convert back from a byte array. This is simple but not industrial strength as someone could still dig out the key store etc.
2) Use a machine unique ID such as the SID with a symmetric algorithm such as Rijndael or Blowfish and provide the SHA-256 hash of the unencrypted license file as the IV. This is a bit more complex to implement as you'd need to use WMI to find the SID and then use System.Security.Cryptography.RijndaelManaged etc to do the encryption/decryption.

内心旳酸楚 2024-08-26 05:45:08

我认为使用该程序集很有创意,但更容易进行逆向工程。使用反射器打开应用程序后,检查许可证的所有位置都可以识别为许可证类别上的属性读取。我看到的另一个问题是版本控制。当 2.0 版本到来时,您的营销团队可能会要求您接受 1.0 许可证。您的 2.0 软件可能有一个带有额外属性的新许可证类别,该许可证类别不再与该类别的 1.0 版本互换。当然,您可以为此制定解决方法,但这会破坏原始设计的简单性。

I think using the assembly is creative, but easier to reverse-engineer. After you open the application with reflector, all locations that check the licenses are recognizable as property reads on the license class. Another problem I see is versioning. When version 2.0 comes, your marketing team might require you to accept 1.0 licenses. Your 2.0 software may have a new license class with extra properties which is no longer interchangible with the 1.0 version of the class. You can make workarounds for that, sure, but it will kind of defeat the simplicity of the original design.

野稚 2024-08-26 05:45:08

我更喜欢程序集版本,因为:

  • 您可以使用authenticode而不是.net签名(您需要它的证书,但这不是昂贵),或者您可以同时使用两者。比在您的应用程序中,您可以检查签名。这消除了被篡改的 .net 标志的安全漏洞。
  • 它更灵活。您可以为许可证组件定义一个接口,该接口可以在以后进行扩展。
  • 您可以在许可证汇编中拥有一些逻辑。

但请记住。这只是一个软件保护。下一步是使用加密密钥(hasp马克思...)

I would prefer the assembly version because:

  • Instead of .net sign, you can use authenticode (you need a certificate for it, but it’s not that expensive), or you can use both. Than in your application, you can check the signature. This removes the security hole for a tampered .net sign.
  • It’s more flexible. You can define an interface for the license assembly which can be later extended.
  • You can have some logic in the license assembly.

But remember. It’s just a software protection. The next step would be to use a crypto key (hasp, marx…)

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