如何生成序列号(注册号)?

发布于 2024-09-07 18:57:38 字数 296 浏览 1 评论 0原文

如何生成用户可以用来注册应用程序的序列号?

我正在考虑以下场景:

  • 用户尝试该应用程序。
  • 当他们想要购买该应用程序时,他们会选择一个菜单项。
  • 该应用程序生成一个代码,然后将该代码传递到网站以购买该应用程序。
  • 用户输入从网站返回的代码。
  • 应用程序用它生成的代码检查输入的代码。

如果用户丢失了序列号,或者在重新安装操作系统后复制了应用程序,他们将需要向网站提供代码,该网站将返回一个特殊代码,允许应用程序获取为用户计算机生成的原始代码。

How can I generate a serial number users can use to register an application?

I was thinking to the following scenario:

  • Users try the application.
  • When they want to buy the application, they select a menu item.
  • The application generates a code that is then passed to the web site to buy the application.
  • Users enter the code returned from the web site.
  • The application checks the entered code with the code it generated.

If users lost the serial number, or copied the application after re-installing the OS, they would require the code to the website, which would return a special code that allow the application to get the original code generated for the users' machine.

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

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

发布评论

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

评论(2

轻拂→两袖风尘 2024-09-14 18:57:38

您可以使用非对称加密和散列来实现此目的:

  1. 将公钥与应用程序捆绑在一起。
  2. 当用户购买应用程序时,他们会提供自己的姓名和电子邮件地址。
  3. 该网站对用户的姓名和电子邮件地址进行哈希处理,使用您的私钥对哈希进行签名,并以 Base64 形式提供结果以方便输入。
  4. 当用户在您的应用程序中输入“代码”以及他们的姓名和电子邮件地址时,您的应用程序可以验证它是否是由您的私钥(只有您/网上商店有权访问)签名的,并且它是否匹配用户提供的姓名和电子邮件。

You could use asymmetric encryption and hashing, to accomplish this:

  1. You bundle your public key with the application.
  2. When the user buys the application, they supply their name and e-mail address.
  3. The web site hashes the user's name and e-mail address, signs the hash with your private key, and provides the result in Base64 to ease typing.
  4. When the user enters the "code" into your application along with their name and e-mail address, your application can verify that it was signed by your private key (which only you/the web store has access to), and that it matches the name and e-mail provided by the user.
青瓷清茶倾城歌 2024-09-14 18:57:38

有几个开源项目甚至不需要考虑这个问题。您可以专注于编写用户实际购买的商品。有一个名为 Aquatic Prime 的开源框架,用于生成序列号。有许多门户网站可以与 Aquatic Prime 配合使用,例如 Shine

当有一个完美的解决方案时,我不喜欢写一些“新”的东西(特别是因为这些项目是免费的)

There are several open source projects out there that eliminate the need to even think about this. You can focus on writing what your user will actually purchase. There is an opensource framework called Aquatic Prime for generating serial numbers. There are many web portals that work with Aquatic Prime like Shine.

I dont like writing something "new" when there is a perfectly good solution out there (especially since these projects are free)

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