【发布时间】:2018-10-09 03:19:15
【问题描述】:
我有一个具有许可证密钥功能的应用程序。
用户获取他们的许可证密钥,然后将其输入到许可证密钥应该去的文本框中,如果许可证密钥有效,他们将被带到主窗体,所有的功能是。
现在,为了使我的程序更安全,我需要能够检查用户是否确实输入了他们的许可证密钥,并且他们没有执行诸如删除(通过反编译)许可证密钥表单之类的操作,以便他们可以访问所有功能所在的主窗体。
注意:我的许可证密钥存储在服务器上。
如何检查用户是否确实输入了许可证密钥?
下面是代码。
AddLicense.vb:
Imports SKM.V3
Imports SKM.V3.Models
Imports SKM.V3.Methods
Public Class AddLicense
Private p_oRandom As Random
Private Const INTERVAL_MIN_SEC As Integer = 4
Private Const INTERVAL_MAX_SEC As Integer = 25
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If BunifuProgressBar1.Value = 50 Then
Label3.Show()
Label2.Hide()
End If
BunifuProgressBar1.Value += 1
If BunifuProgressBar1.Value = BunifuProgressBar1.MaximumValue Then
BunifuProgressBar1.Hide()
Label3.Hide()
Label2.Hide()
Timer1.Stop()
BunifuMaterialTextbox1.Show()
BunifuThinButton21.Show()
Label4.Show()
LinkLabel1.Show()
BunifuThinButton22.Show()
End If
Timer1.Interval = p_oRandom.Next(INTERVAL_MIN_SEC, INTERVAL_MAX_SEC) * 3
End Sub
Private Sub BunifuImageButton1_Click(sender As Object, e As EventArgs) Handles BunifuImageButton1.Click
Me.Close()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
p_oRandom = New Random
End Sub
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Try
Process.Start("https://selly.gg")
Catch ex As Exception
End Try
End Sub
Sub Nolicense()
BunifuThinButton21.Enabled = False
End Sub
Private Sub BunifuThinButton21_Click_1(sender As Object, e As EventArgs) Handles BunifuThinButton21.Click
Dim token = "WyIxMDM2IiwiZ082d2dnS0FmTkRuTXNPcGhlSkllVEx6ckFWMFhhSzlMM3Rvc01xUSJd"
Dim key = BunifuMaterialTextbox1.Text.Replace(" ", "")
Dim license = New LicenseKey() With
{
.ProductId = 3888,
.Key = key
}
If license.Refresh(token, True) Then
' we are able to auto complete missing key info
Me.BunifuThinButton21.Enabled = license.HasFeature(1).IsValid() ' either we have feature1 or not.
MsgBox("License is valid! Thanks for purchasing.")
Me.Hide()
Sploitbase.Show()
If license.HasFeature(4).HasNotExpired().IsValid() Then
Me.Hide()
Sploitbase.Show()
ElseIf license.HasNotFeature(4).IsValid() Then
Else
MsgBox("Your license has expired and cannot be used.")
Nolicense()
End If
license.SaveToFile()
Else
' something went wrong.
MsgBox("Unable to access the license server or the key is wrong.")
End If
Me.Close()
End Sub
Private Sub BunifuThinButton22_Click(sender As Object, e As EventArgs) Handles BunifuThinButton22.Click
End Sub
End Class
Sploitbase.vb - 主要形式:
Imports SKM.V3
Public Class Sploitbase
Private Sub Sploitbase_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Public Sub NoLicense()
End Sub
Private Sub TabPage1_Click(sender As Object, e As EventArgs)
End Sub
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs)
Try
Process.Start("https://selly.gg")
Catch ex As Exception
End Try
End Sub
End Class
【问题讨论】:
-
'删除许可证密钥表格'?你的意思是密钥表格可以关闭?尝试使用 frm.showdialog(),而不是 form.show...
-
不,他不是那个意思,他的意思是从字面上反编译它并删除表单(很可能)。
标签: vb.net validation license-key