VB项目的许可证密钥 [英] Licence key to vb project

查看:450
本文介绍了VB项目的许可证密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.在分发之前,如何为软件分配许可证密钥?
2.我希望每个安装在每台PC上都有一个唯一的密钥.

1. How will I assign a License Key to my software before I distribute?
2. I want each installation to have a unique key per PC.

推荐答案

有很多CP上的文章 [本文 [
There are a lot of articles on CP[^] that could point you in the right direction.

This article [^] helped me when I was looking for a unique value. It discusses pulling info about a computer with WMI. I use it to pull a ComputerSystemProduct UUID which so far appears to be unique for each computer (no guarantees). These are the methods I used to pull it:

''' <summary>
   ''' Uses WMI to find all ComputerSystemProduct UUIDs and returns them (concatenated) in a string.
   ''' In testing, this value appears to be unique for each machine.
   ''' </summary>
   ''' <returns></returns>
   ''' <remarks></remarks>
   Private Function GetComputerSystemProductUUID() As String
       Return GetManagementObject("UUID", "Win32_ComputerSystemProduct")
   End Function

   ''' <summary>
   ''' Uses WMI to pull properties (specified by the strPropery parm) from collections of management objects
   ''' and returns a concatenated string of all properties from all collections found on the machine.
   ''' </summary>
   ''' <param name="strProperty"></param>
   ''' <param name="strCollection"></param>
   ''' <returns></returns>
   ''' <remarks></remarks>
   Private Function GetManagementObject(ByVal strProperty As String, ByVal strCollection As String) As String
       Dim sb As New System.Text.StringBuilder
       Try
           'Use a ManagementObjectSearcher object to select a property from a collection
           Dim objSearcher As New ManagementObjectSearcher("SELECT " & strProperty & " FROM " & strCollection)
           Dim objCollection As ManagementObjectCollection = objSearcher.Get
           For Each objM As ManagementObject In objCollection
               For Each objP As PropertyData In objM.Properties
                   If objP.Value IsNot DBNull.Value Then
                       sb.Append(objP.Value) 'Concats together if there are multiple collections or properties
                   End If
               Next
           Next
           'Clean up objects
           objSearcher.Dispose()
           objCollection.Dispose()
       Catch ex As Exception
           MsgBox(ex.Message)
       End Try

       Return sb.ToString
   End Function



希望对您有所帮助.



Hope this helps.


有多种方法可以实现这一目标
1)加密的许可证文件,其中包含到期日期等.
2)注册表中保存的加密许可证密钥
3)需要Internet连接的质询/响应机制
4)可能是其他人.......
尝试:
许可证密钥生成 [如何为我的C#应用​​创建产品密钥 [ ^ ]或:c#许可 [ ^ ]
其中有两个使用C#,可以看出它是从VB开始的
还有,
.NET Framework的密码学101 [
There are different ways to achieve this
1) encrypted license files that contains the expiry dates etc.
2) encrypted license keys held in the registry
3) challenge/response mechanism which require an internet connection
4) probably others.......
Try: License Key Generation[^] or: How can I create a Product Key for my C# App[^] or: c# Licensing[^]
Couple of them are in C# which can be seen to start on VB
Also,
Cryptography 101 for the .NET Framework[^]
Hope this helps.


如果您希望防止用户将软件重新分发给他人,则这样的许可证密钥是没有用的.唯一的方法是在用户计算机上生成代码,该代码由您解码并通过邮件或其他方式发送给他. (通过在线产品激活完成相同的操作).如果要脱机完成,那么我上面提到的是唯一的答案.我已经开发了它并且可以使用.
If you wish to prevent users re-distributing the software to others, license key as such is of no use. Only way is to generate a code on users machine which is decoded by you and sent to him by mail or other means. (same is done by on line product activation). If it is to be done offline then what I mentioned above is the only answer. I have developed it and it works.


这篇关于VB项目的许可证密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆