Version 20180904
This commit is contained in:
34
DPMLizenzmanagement/SHUKeyGen/Crypto.vb
Normal file
34
DPMLizenzmanagement/SHUKeyGen/Crypto.vb
Normal file
@@ -0,0 +1,34 @@
|
||||
Module Crypto
|
||||
Public Function EncryptText(ByVal strText As String, ByVal strPwd As String)
|
||||
Dim i As Integer, c As Integer
|
||||
Dim strBuff As String
|
||||
|
||||
strPwd = UCase$(strPwd)
|
||||
If Len(strPwd) Then
|
||||
For i = 1 To Len(strText)
|
||||
c = Asc(Mid$(strText, i, 1))
|
||||
c = c + Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
|
||||
strBuff = strBuff & Chr(c And &HFF)
|
||||
Next i
|
||||
Else
|
||||
strBuff = strText
|
||||
End If
|
||||
EncryptText = strBuff
|
||||
End Function
|
||||
|
||||
Public Function DecryptText(ByVal strText As String, ByVal strPwd As String)
|
||||
Dim i As Integer, c As Integer
|
||||
Dim strBuff As String
|
||||
strPwd = UCase$(strPwd)
|
||||
If Len(strPwd) Then
|
||||
For i = 1 To Len(strText)
|
||||
c = Asc(Mid$(strText, i, 1))
|
||||
c = c - Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
|
||||
strBuff = strBuff & Chr(c And &HFF)
|
||||
Next i
|
||||
Else
|
||||
strBuff = strText
|
||||
End If
|
||||
DecryptText = strBuff
|
||||
End Function
|
||||
End Module
|
||||
256
DPMLizenzmanagement/SHUKeyGen/KeyCode.vb
Normal file
256
DPMLizenzmanagement/SHUKeyGen/KeyCode.vb
Normal file
@@ -0,0 +1,256 @@
|
||||
Module KeyCode
|
||||
'Attribute VB_Name = "KeyCode"
|
||||
' *
|
||||
' * KeyCodeGen Module
|
||||
' * Copyright (C) 2007 John Mazza.
|
||||
' *
|
||||
' * Written by John Mazza <maz@mgcworks.com>
|
||||
' *
|
||||
' * This library is free software; you can redistribute it and/or
|
||||
' * modify it under the terms of the GNU Lesser General Public
|
||||
' * License Version 2.1 as published by the Free Software Foundation.
|
||||
' *
|
||||
' * This library is distributed in the hope that it will be useful,
|
||||
' * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
' * Lesser General Public License for more details.
|
||||
' *
|
||||
' * You should have received a copy of the GNU Lesser General Public
|
||||
' * License along with this library; if not, write to the Free Software
|
||||
' * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
' ****************************************************************************
|
||||
'
|
||||
'
|
||||
' PURPOSE
|
||||
' Generate a licening key code that encodes product features into the
|
||||
' "keycode" string securely.
|
||||
'
|
||||
' LANGUAGE
|
||||
' Visual Basic 6.0 or VBA6
|
||||
' Should work in VB.NET as well
|
||||
'
|
||||
' DEPENDENCIES:
|
||||
' Requires 'Visual Basic MD5 Implementation' by
|
||||
' Robert Hubley and David Midkiff (mdj2023@hotmail.com) and
|
||||
' StrFuncs module by John Mazza
|
||||
'
|
||||
|
||||
|
||||
' GenKeyString() generates the actual keycode string based on
|
||||
' modified MD5 hashes of Username, Product, and licensed "features"
|
||||
|
||||
Public Function GenKeyString(ByVal UserName As String, ProdName As String, F_Code As Long) As String
|
||||
|
||||
Dim TempStr As String
|
||||
Dim KeyStr As String
|
||||
Dim KeyVal As String
|
||||
Dim CodeVal As Long
|
||||
Dim CodeLow As Byte
|
||||
Dim CodeHigh As Byte
|
||||
Dim KeyLowV1 As Byte
|
||||
Dim KeyLowV2 As Byte
|
||||
Dim KeyLow1 As Object
|
||||
Dim KeyLow2 As Object
|
||||
Dim ChrV1 As Char
|
||||
Dim ChrV2 As Char
|
||||
Dim RawChk As Object
|
||||
Dim RC1 As Object
|
||||
Dim RC2 As Object
|
||||
Dim StubStr As String
|
||||
|
||||
|
||||
|
||||
' Make sure we're not case-sensitive since that is a pain for end users
|
||||
|
||||
TempStr = LCase(UserName) & LCase(ProdName)
|
||||
KeyStr = DigestStrToHexStr(TempStr)
|
||||
KeyVal = HexStrToBinStr(KeyStr)
|
||||
|
||||
' Mask off low order 16 bits from F_Code
|
||||
CodeVal = F_Code And &HFFFF
|
||||
CodeLow = CodeVal And &HFF
|
||||
CodeHigh = (((CodeVal And &HFF00) / 256) And &HFF)
|
||||
|
||||
KeyLow1 = Mid(KeyVal, Len(KeyVal), 1)
|
||||
KeyLow2 = Mid(KeyVal, Len(KeyVal) - 1, 1)
|
||||
|
||||
KeyLowV1 = Asc(KeyLow1)
|
||||
KeyLowV2 = Asc(KeyLow2)
|
||||
|
||||
KeyLowV1 = (KeyLowV1 Xor CodeLow)
|
||||
KeyLowV2 = (KeyLowV2 Xor CodeHigh)
|
||||
|
||||
'KeyLowV1 = KeyLowV1 Xor KeyLowV2
|
||||
ChrV1 = Chr(KeyLowV1)
|
||||
ChrV2 = Chr(KeyLowV2)
|
||||
|
||||
' Cut original first 2 bytes from KeyVal string
|
||||
KeyVal = Mid(KeyVal, 1, Len(KeyVal) - 2)
|
||||
|
||||
' Now append modified bytes
|
||||
KeyVal = KeyVal & ChrV2 & ChrV1
|
||||
'KeyVal = KeyVal & ChrV1
|
||||
|
||||
' Now we get sneaky and modify the KeyVal by replacing the first 2 bytes
|
||||
' of KeyVal with the first and last bytes of the MD5 of KeyVal minus first 2 bytes
|
||||
|
||||
KeyVal = Mid(KeyVal, 3, Len(KeyVal) - 2)
|
||||
|
||||
RawChk = DigestStrToHexStr(KeyVal)
|
||||
|
||||
RC1 = Mid(RawChk, 1, 2)
|
||||
RC2 = Mid(RawChk, Len(RawChk) - 1, 2)
|
||||
|
||||
StubStr = BinStrToHexStr(KeyVal)
|
||||
|
||||
GenKeyString = RC1 & RC2 & StubStr
|
||||
|
||||
End Function
|
||||
|
||||
' ValidateKeyCode() validates that a keycode is valid.
|
||||
' Basically it is the inverse of GenKeyString()
|
||||
|
||||
Public Function ValidateKeyCode(ByVal KeyCode As String, UserName As String, ProjName As String) As Boolean
|
||||
Dim ActiveBytes As String
|
||||
Dim LUNameHash As String
|
||||
Dim LUName As String
|
||||
Dim ValidKey As Boolean
|
||||
Dim KeyMD5 As String
|
||||
Dim KeySig As String
|
||||
|
||||
Dim BinKeyCode As Object
|
||||
Dim ValidSig As Object
|
||||
|
||||
ValidKey = False
|
||||
|
||||
' Key must be 32 bytes long - otherwise reject immediately
|
||||
|
||||
If Len(KeyCode) = 32 Then
|
||||
BinKeyCode = HexStrToBinStr(KeyCode)
|
||||
ActiveBytes = Right(BinKeyCode, 14)
|
||||
KeyMD5 = DigestStrToHexStr(ActiveBytes)
|
||||
ValidSig = Left(KeyMD5, 2) & Right(KeyMD5, 2)
|
||||
KeySig = Left(KeyCode, 4)
|
||||
|
||||
If KeySig = ValidSig Then
|
||||
ValidKey = True
|
||||
Else
|
||||
ValidKey = False
|
||||
End If
|
||||
|
||||
If ValidKey Then
|
||||
LUName = LCase(UserName) & LCase(ProjName)
|
||||
LUNameHash = DigestStrToHexStr(LUName)
|
||||
|
||||
ActiveBytes = Mid(KeyCode, 5, 24)
|
||||
LUNameHash = Mid(LUNameHash, 5, 24)
|
||||
|
||||
If ActiveBytes = LUNameHash Then
|
||||
ValidKey = True
|
||||
Else
|
||||
ValidKey = False
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
ValidKey = False
|
||||
End If
|
||||
|
||||
ValidateKeyCode = ValidKey
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
' ExtractKeyFBits() returns the bitmap originally passed as F_Code
|
||||
' when a key is created with GenKeyString()
|
||||
' Note: it will return zero (0) if an invalid keycode is passed or if
|
||||
' username or projectname are not a match.
|
||||
|
||||
Public Function ExtractKeyFBits(ByVal KeyCode As String, UserName As String, ProjName As String)
|
||||
Dim PermVal As Long
|
||||
Dim RealHash As String
|
||||
Dim LUser As String
|
||||
Dim Perms As Long
|
||||
Dim BinCodePerm As String
|
||||
Dim BinUHashPerm As String
|
||||
Dim HiCodePerm As Byte
|
||||
Dim HIUMask As Byte
|
||||
Dim LoUMask As Byte
|
||||
Dim HiPerm As Long
|
||||
Dim LoPerm As Long
|
||||
|
||||
Dim UserHash As Object
|
||||
Dim KCodedPerm As Object
|
||||
Dim UHashPerm As Object
|
||||
Dim LoCodePerm As Object
|
||||
PermVal = 0
|
||||
|
||||
If ValidateKeyCode(KeyCode, UserName, ProjName) Then
|
||||
|
||||
LUser = LCase(UserName) & LCase(ProjName)
|
||||
UserHash = DigestStrToHexStr(LUser)
|
||||
KCodedPerm = Right(KeyCode, 4)
|
||||
UHashPerm = Right(UserHash, 4)
|
||||
|
||||
BinCodePerm = HexStrToBinStr(KCodedPerm)
|
||||
BinUHashPerm = HexStrToBinStr(UHashPerm)
|
||||
|
||||
HiCodePerm = Asc(Mid(BinCodePerm, 1, 1))
|
||||
LoCodePerm = Asc(Mid(BinCodePerm, 2, 1))
|
||||
|
||||
HIUMask = Asc(Mid(BinUHashPerm, 1, 1))
|
||||
LoUMask = Asc(Mid(BinUHashPerm, 2, 1))
|
||||
|
||||
HiPerm = HiCodePerm Xor HIUMask
|
||||
LoPerm = LoCodePerm Xor LoUMask
|
||||
PermVal = (HiPerm * 256) Or LoPerm
|
||||
|
||||
Else
|
||||
PermVal = 0
|
||||
End If
|
||||
|
||||
ExtractKeyFBits = PermVal
|
||||
|
||||
End Function
|
||||
|
||||
Public Function FormatKeyCode(ByVal StrIn As String, ByVal GrpLen As Long) As String
|
||||
Dim StrLen As Long
|
||||
Dim CurGrp As Long
|
||||
Dim OutStr As String
|
||||
Dim GrpStr As String
|
||||
Dim GrpStart As Long
|
||||
|
||||
Dim StrGroups As Object
|
||||
Dim StrLeftOver As Object
|
||||
StrLen = Len(StrIn)
|
||||
|
||||
StrGroups = Int(StrLen / GrpLen)
|
||||
StrLeftOver = StrLen Mod GrpLen
|
||||
|
||||
' Run loop to add dashes into StrIn
|
||||
|
||||
For CurGrp = 0 To (StrGroups - 1)
|
||||
GrpStart = (CurGrp * GrpLen) + 1
|
||||
GrpStr = Mid(StrIn, GrpStart, GrpLen)
|
||||
|
||||
If CurGrp > 0 Then
|
||||
OutStr = OutStr & "-" & GrpStr
|
||||
Else
|
||||
OutStr = OutStr & GrpStr
|
||||
End If
|
||||
|
||||
Next CurGrp
|
||||
|
||||
' Append a final group if any leftover charaters
|
||||
' exist in StrIn
|
||||
|
||||
If StrLeftOver > 0 Then
|
||||
OutStr = OutStr & "-" & Right(StrIn, StrLeftOver)
|
||||
End If
|
||||
|
||||
FormatKeyCode = OutStr
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
End Module
|
||||
348
DPMLizenzmanagement/SHUKeyGen/MD5_Crypt.vb
Normal file
348
DPMLizenzmanagement/SHUKeyGen/MD5_Crypt.vb
Normal file
@@ -0,0 +1,348 @@
|
||||
Imports System.IO
|
||||
Module MD5_Crypt
|
||||
'Attribute VB_Name = "MD5_Crypt"
|
||||
'Option Explicit On
|
||||
|
||||
' Visual Basic MD5 Implementation
|
||||
' Robert Hubley and David MidkiFF ((mdj2023@hotmail.com)
|
||||
'
|
||||
' Standard MD5 implementation optimised for the Visual Basic environment.
|
||||
' Conforms to all standards and can be used in digital signature or password
|
||||
' protection related schemes.
|
||||
'
|
||||
' NOTE - JDM 5/23/2007
|
||||
' (Research indicates this code is Licensed for free use)
|
||||
'
|
||||
|
||||
Private Const OFFSET_4 = 4294967296.0#
|
||||
Private Const MAXINT_4 = 2147483647
|
||||
Private State(4) As Long
|
||||
Dim ByteCounter As Long
|
||||
Dim ByteBuffer(63) As Byte
|
||||
Private Const S11 = 7
|
||||
Private Const S12 = 12
|
||||
Private Const S13 = 17
|
||||
Private Const S14 = 22
|
||||
Private Const S21 = 5
|
||||
Private Const S22 = 9
|
||||
Private Const S23 = 14
|
||||
Private Const S24 = 20
|
||||
Private Const S31 = 4
|
||||
Private Const S32 = 11
|
||||
Private Const S33 = 16
|
||||
Private Const S34 = 23
|
||||
Private Const S41 = 6
|
||||
Private Const S42 = 10
|
||||
Private Const S43 = 15
|
||||
Private Const S44 = 21
|
||||
|
||||
Dim M_RegistryA As String
|
||||
Dim M_RegistryB As String
|
||||
Dim M_RegistryC As String
|
||||
Dim M_RegistryD As String
|
||||
Property RegistryA As String
|
||||
Get
|
||||
Return M_RegistryA
|
||||
End Get
|
||||
Set(value As String)
|
||||
M_RegistryA = State(1)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property RegistryB As String
|
||||
Get
|
||||
Return M_RegistryB
|
||||
End Get
|
||||
Set(value As String)
|
||||
M_RegistryB = State(2)
|
||||
End Set
|
||||
End Property
|
||||
Property RegistryC As String
|
||||
Get
|
||||
Return M_RegistryC
|
||||
End Get
|
||||
Set(value As String)
|
||||
M_RegistryC = State(3)
|
||||
End Set
|
||||
End Property
|
||||
Property RegistryD As String
|
||||
Get
|
||||
Return M_RegistryD
|
||||
End Get
|
||||
Set(value As String)
|
||||
M_RegistryD = State(4)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
Public Function DigestStrToHexStr(ByVal SourceString As String) As String
|
||||
MD5Init()
|
||||
MD5Update(Len(SourceString), StringToArray(SourceString))
|
||||
MD5Final()
|
||||
DigestStrToHexStr = GetValues()
|
||||
End Function
|
||||
|
||||
Public Function DigestFileToHexStr(InFile As String) As String
|
||||
Try
|
||||
Dim fInfo As New System.IO.FileInfo(InFile)
|
||||
Dim numBytes As Long = fInfo.Length
|
||||
Dim fs As New FileStream(InFile, FileMode.Open, FileAccess.Read)
|
||||
Dim br As New System.IO.BinaryReader(fs)
|
||||
Dim bytes As Byte() = br.ReadBytes(CInt(numBytes))
|
||||
br.Close()
|
||||
fs.Close()
|
||||
|
||||
MD5Init()
|
||||
|
||||
MD5Transform(bytes)
|
||||
|
||||
ByteCounter = bytes.Count Mod 64
|
||||
|
||||
|
||||
MD5Final()
|
||||
|
||||
DigestFileToHexStr = GetValues()
|
||||
|
||||
Catch ex As Exception
|
||||
DigestFileToHexStr = ""
|
||||
Exit Function
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function StringToArray(InString As String) As Byte()
|
||||
Dim i As Integer, bytBuffer() As Byte
|
||||
ReDim bytBuffer(Len(InString))
|
||||
For i = 0 To Len(InString) - 1
|
||||
bytBuffer(i) = Asc(Mid$(InString, i + 1, 1))
|
||||
Next i
|
||||
StringToArray = bytBuffer
|
||||
End Function
|
||||
|
||||
Public Function GetValues() As String
|
||||
GetValues = LongToString(State(1)) & LongToString(State(2)) & LongToString(State(3)) & LongToString(State(4))
|
||||
End Function
|
||||
|
||||
Private Function LongToString(Num As Long) As String
|
||||
Dim A As Byte, B As Byte, C As Byte, D As Byte
|
||||
A = Num And &HFF&
|
||||
If A < 16 Then LongToString = "0" & Hex(A) Else LongToString = Hex(A)
|
||||
B = (Num And &HFF00&) \ 256
|
||||
If B < 16 Then LongToString = LongToString & "0" & Hex(B) Else LongToString = LongToString & Hex(B)
|
||||
C = (Num And &HFF0000) \ 65536
|
||||
If C < 16 Then LongToString = LongToString & "0" & Hex(C) Else LongToString = LongToString & Hex(C)
|
||||
If Num < 0 Then D = ((Num And &H7F000000) \ 16777216) Or &H80& Else D = (Num And &HFF000000) \ 16777216
|
||||
If D < 16 Then LongToString = LongToString & "0" & Hex(D) Else LongToString = LongToString & Hex(D)
|
||||
End Function
|
||||
|
||||
Public Sub MD5Init()
|
||||
ByteCounter = 0
|
||||
State(1) = UnsignedToLong(1732584193.0#)
|
||||
State(2) = UnsignedToLong(4023233417.0#)
|
||||
State(3) = UnsignedToLong(2562383102.0#)
|
||||
State(4) = UnsignedToLong(271733878.0#)
|
||||
End Sub
|
||||
|
||||
Public Sub MD5Final()
|
||||
Dim dblBits As Double, padding(72) As Byte, lngBytesBuffered As Long
|
||||
padding(0) = &H80
|
||||
dblBits = ByteCounter * 8
|
||||
lngBytesBuffered = ByteCounter Mod 64
|
||||
If lngBytesBuffered <= 56 Then MD5Update(56 - lngBytesBuffered, padding) Else MD5Update(120 - ByteCounter, padding)
|
||||
padding(0) = UnsignedToLong(dblBits) And &HFF&
|
||||
padding(1) = UnsignedToLong(dblBits) \ 256 And &HFF&
|
||||
padding(2) = UnsignedToLong(dblBits) \ 65536 And &HFF&
|
||||
padding(3) = UnsignedToLong(dblBits) \ 16777216 And &HFF&
|
||||
padding(4) = 0
|
||||
padding(5) = 0
|
||||
padding(6) = 0
|
||||
padding(7) = 0
|
||||
MD5Update(8, padding)
|
||||
End Sub
|
||||
|
||||
Public Sub MD5Update(InputLen As Long, InputBuffer() As Byte)
|
||||
Dim II As Integer, i As Integer, J As Integer, K As Integer, lngBufferedBytes As Long, lngBufferRemaining As Long, lngRem As Long
|
||||
|
||||
lngBufferedBytes = ByteCounter Mod 64
|
||||
lngBufferRemaining = 64 - lngBufferedBytes
|
||||
ByteCounter = ByteCounter + InputLen
|
||||
|
||||
If InputLen >= lngBufferRemaining Then
|
||||
For II = 0 To lngBufferRemaining - 1
|
||||
ByteBuffer(lngBufferedBytes + II) = InputBuffer(II)
|
||||
Next II
|
||||
MD5Transform(ByteBuffer)
|
||||
lngRem = (InputLen) Mod 64
|
||||
For i = lngBufferRemaining To InputLen - II - lngRem Step 64
|
||||
For J = 0 To 63
|
||||
ByteBuffer(J) = InputBuffer(i + J)
|
||||
Next J
|
||||
MD5Transform(ByteBuffer)
|
||||
Next i
|
||||
lngBufferedBytes = 0
|
||||
Else
|
||||
i = 0
|
||||
End If
|
||||
For K = 0 To InputLen - i - 1
|
||||
ByteBuffer(lngBufferedBytes + K) = InputBuffer(i + K)
|
||||
Next K
|
||||
End Sub
|
||||
|
||||
Dim X(16) As Long, A As Long, B As Long, C As Long, D As Long
|
||||
Private Sub MD5Transform(Buffer() As Byte)
|
||||
|
||||
|
||||
A = State(1)
|
||||
B = State(2)
|
||||
C = State(3)
|
||||
D = State(4)
|
||||
Decode(64, X, Buffer)
|
||||
FF(A, B, C, D, X(0), S11, -680876936)
|
||||
FF(D, A, B, C, X(1), S12, -389564586)
|
||||
FF(C, D, A, B, X(2), S13, 606105819)
|
||||
FF(B, C, D, A, X(3), S14, -1044525330)
|
||||
FF(A, B, C, D, X(4), S11, -176418897)
|
||||
FF(D, A, B, C, X(5), S12, 1200080426)
|
||||
FF(C, D, A, B, X(6), S13, -1473231341)
|
||||
FF(B, C, D, A, X(7), S14, -45705983)
|
||||
FF(A, B, C, D, X(8), S11, 1770035416)
|
||||
FF(D, A, B, C, X(9), S12, -1958414417)
|
||||
FF(C, D, A, B, X(10), S13, -42063)
|
||||
FF(B, C, D, A, X(11), S14, -1990404162)
|
||||
FF(A, B, C, D, X(12), S11, 1804603682)
|
||||
FF(D, A, B, C, X(13), S12, -40341101)
|
||||
FF(C, D, A, B, X(14), S13, -1502002290)
|
||||
FF(B, C, D, A, X(15), S14, 1236535329)
|
||||
|
||||
GG(A, B, C, D, X(1), S21, -165796510)
|
||||
GG(D, A, B, C, X(6), S22, -1069501632)
|
||||
GG(C, D, A, B, X(11), S23, 643717713)
|
||||
GG(B, C, D, A, X(0), S24, -373897302)
|
||||
GG(A, B, C, D, X(5), S21, -701558691)
|
||||
GG(D, A, B, C, X(10), S22, 38016083)
|
||||
GG(C, D, A, B, X(15), S23, -660478335)
|
||||
GG(B, C, D, A, X(4), S24, -405537848)
|
||||
GG(A, B, C, D, X(9), S21, 568446438)
|
||||
GG(D, A, B, C, X(14), S22, -1019803690)
|
||||
GG(C, D, A, B, X(3), S23, -187363961)
|
||||
GG(B, C, D, A, X(8), S24, 1163531501)
|
||||
GG(A, B, C, D, X(13), S21, -1444681467)
|
||||
GG(D, A, B, C, X(2), S22, -51403784)
|
||||
GG(C, D, A, B, X(7), S23, 1735328473)
|
||||
GG(B, C, D, A, X(12), S24, -1926607734)
|
||||
|
||||
HH(A, B, C, D, X(5), S31, -378558)
|
||||
HH(D, A, B, C, X(8), S32, -2022574463)
|
||||
HH(C, D, A, B, X(11), S33, 1839030562)
|
||||
HH(B, C, D, A, X(14), S34, -35309556)
|
||||
HH(A, B, C, D, X(1), S31, -1530992060)
|
||||
HH(D, A, B, C, X(4), S32, 1272893353)
|
||||
HH(C, D, A, B, X(7), S33, -155497632)
|
||||
HH(B, C, D, A, X(10), S34, -1094730640)
|
||||
HH(A, B, C, D, X(13), S31, 681279174)
|
||||
HH(D, A, B, C, X(0), S32, -358537222)
|
||||
HH(C, D, A, B, X(3), S33, -722521979)
|
||||
HH(B, C, D, A, X(6), S34, 76029189)
|
||||
HH(A, B, C, D, X(9), S31, -640364487)
|
||||
HH(D, A, B, C, X(12), S32, -421815835)
|
||||
HH(C, D, A, B, X(15), S33, 530742520)
|
||||
HH(B, C, D, A, X(2), S34, -995338651)
|
||||
|
||||
II(A, B, C, D, X(0), S41, -198630844)
|
||||
II(D, A, B, C, X(7), S42, 1126891415)
|
||||
II(C, D, A, B, X(14), S43, -1416354905)
|
||||
II(B, C, D, A, X(5), S44, -57434055)
|
||||
II(A, B, C, D, X(12), S41, 1700485571)
|
||||
II(D, A, B, C, X(3), S42, -1894986606)
|
||||
II(C, D, A, B, X(10), S43, -1051523)
|
||||
II(B, C, D, A, X(1), S44, -2054922799)
|
||||
II(A, B, C, D, X(8), S41, 1873313359)
|
||||
II(D, A, B, C, X(15), S42, -30611744)
|
||||
II(C, D, A, B, X(6), S43, -1560198380)
|
||||
II(B, C, D, A, X(13), S44, 1309151649)
|
||||
II(A, B, C, D, X(4), S41, -145523070)
|
||||
II(D, A, B, C, X(11), S42, -1120210379)
|
||||
II(C, D, A, B, X(2), S43, 718787259)
|
||||
II(B, C, D, A, X(9), S44, -343485551)
|
||||
|
||||
State(1) = LongOverflowAdd(State(1), A)
|
||||
State(2) = LongOverflowAdd(State(2), B)
|
||||
State(3) = LongOverflowAdd(State(3), C)
|
||||
State(4) = LongOverflowAdd(State(4), D)
|
||||
End Sub
|
||||
|
||||
Private Sub Decode(Length As Integer, OutputBuffer() As Long, InputBuffer() As Byte)
|
||||
Dim intDblIndex As Integer, intByteIndex As Integer, dblSum As Double
|
||||
For intByteIndex = 0 To Length - 1 Step 4
|
||||
dblSum = InputBuffer(intByteIndex) + InputBuffer(intByteIndex + 1) * 256.0# + InputBuffer(intByteIndex + 2) * 65536.0# + InputBuffer(intByteIndex + 3) * 16777216.0#
|
||||
OutputBuffer(intDblIndex) = UnsignedToLong(dblSum)
|
||||
intDblIndex = intDblIndex + 1
|
||||
Next intByteIndex
|
||||
End Sub
|
||||
|
||||
Private Function FF(ByRef A As Long, ByRef B As Long, ByRef C As Long, ByRef D As Long, ByRef X As Long, ByRef S As Long, ByRef ac As Long) As Long
|
||||
A = LongOverflowAdd4(A, (B And C) Or (Not (B) And D), X, ac)
|
||||
A = LongLeftRotate(A, S)
|
||||
A = LongOverflowAdd(A, B)
|
||||
End Function
|
||||
|
||||
Private Function GG(ByRef A As Long, ByRef B As Long, ByRef C As Long, ByRef D As Long, ByRef X As Long, ByRef S As Long, ByRef ac As Long) As Long
|
||||
A = LongOverflowAdd4(A, (B And D) Or (C And Not (D)), X, ac)
|
||||
A = LongLeftRotate(A, S)
|
||||
A = LongOverflowAdd(A, B)
|
||||
End Function
|
||||
|
||||
Private Function HH(ByRef A As Long, ByRef B As Long, ByRef C As Long, ByRef D As Long, ByRef X As Long, ByRef S As Long, ByRef ac As Long) As Long
|
||||
A = LongOverflowAdd4(A, B Xor C Xor D, X, ac)
|
||||
A = LongLeftRotate(A, S)
|
||||
A = LongOverflowAdd(A, B)
|
||||
End Function
|
||||
|
||||
Private Function II(ByRef A As Long, ByRef B As Long, ByRef C As Long, ByRef D As Long, ByRef X As Long, ByRef S As Long, ByRef ac As Long) As Long
|
||||
A = LongOverflowAdd4(A, C Xor (B Or Not (D)), X, ac)
|
||||
A = LongLeftRotate(A, S)
|
||||
A = LongOverflowAdd(A, B)
|
||||
End Function
|
||||
|
||||
Function LongLeftRotate(value As Long, Bits As Long) As Long
|
||||
Dim lngSign As Long, lngI As Long
|
||||
Bits = Bits Mod 32
|
||||
If Bits = 0 Then LongLeftRotate = value : Exit Function
|
||||
For lngI = 1 To Bits
|
||||
lngSign = value And &HC0000000
|
||||
value = (value And &H3FFFFFFF) * 2
|
||||
value = value Or ((lngSign < 0) And 1) Or (CBool(lngSign And &H40000000) And &H80000000)
|
||||
Next
|
||||
LongLeftRotate = value
|
||||
End Function
|
||||
|
||||
Private Function LongOverflowAdd(Val1 As Long, Val2 As Long) As Long
|
||||
Dim lngHighWord As Long, lngLowWord As Long, lngOverflow As Long
|
||||
lngLowWord = (Val1 And &HFFFF&) + (Val2 And &HFFFF&)
|
||||
lngOverflow = lngLowWord \ 65536
|
||||
lngHighWord = (((Val1 And &HFFFF0000) \ 65536) + ((Val2 And &HFFFF0000) \ 65536) + lngOverflow) And &HFFFF&
|
||||
LongOverflowAdd = UnsignedToLong((lngHighWord * 65536.0#) + (lngLowWord And &HFFFF&))
|
||||
End Function
|
||||
|
||||
Private Function LongOverflowAdd4(Val1 As Long, Val2 As Long, val3 As Long, val4 As Long) As Long
|
||||
Dim lngHighWord As Long, lngLowWord As Long, lngOverflow As Long
|
||||
lngLowWord = (Val1 And &HFFFF&) + (Val2 And &HFFFF&) + (val3 And &HFFFF&) + (val4 And &HFFFF&)
|
||||
lngOverflow = lngLowWord \ 65536
|
||||
lngHighWord = (((Val1 And &HFFFF0000) \ 65536) + ((Val2 And &HFFFF0000) \ 65536) + ((val3 And &HFFFF0000) \ 65536) + ((val4 And &HFFFF0000) \ 65536) + lngOverflow) And &HFFFF&
|
||||
LongOverflowAdd4 = UnsignedToLong((lngHighWord * 65536.0#) + (lngLowWord And &HFFFF&))
|
||||
End Function
|
||||
|
||||
Private Function UnsignedToLong(value As Double) As Long
|
||||
If value < 0 Or value >= OFFSET_4 Then Error 6
|
||||
If value <= MAXINT_4 Then UnsignedToLong = value Else UnsignedToLong = value - OFFSET_4
|
||||
End Function
|
||||
|
||||
Private Function LongToUnsigned(value As Long) As Double
|
||||
If value < 0 Then LongToUnsigned = value + OFFSET_4 Else LongToUnsigned = value
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
End Module
|
||||
13
DPMLizenzmanagement/SHUKeyGen/My Project/Application.Designer.vb
generated
Normal file
13
DPMLizenzmanagement/SHUKeyGen/My Project/Application.Designer.vb
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
10
DPMLizenzmanagement/SHUKeyGen/My Project/Application.myapp
Normal file
10
DPMLizenzmanagement/SHUKeyGen/My Project/Application.myapp
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>false</MySubMain>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>1</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
35
DPMLizenzmanagement/SHUKeyGen/My Project/AssemblyInfo.vb
Normal file
35
DPMLizenzmanagement/SHUKeyGen/My Project/AssemblyInfo.vb
Normal file
@@ -0,0 +1,35 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
' die einer Assembly zugeordnet sind.
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("SHUKeyGen")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("SHUKeyGen")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2018")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
<Assembly: Guid("f196bbba-a086-4e96-b4a8-d6136473234a")>
|
||||
|
||||
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
'
|
||||
' Hauptversion
|
||||
' Nebenversion
|
||||
' Buildnummer
|
||||
' Revision
|
||||
'
|
||||
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
62
DPMLizenzmanagement/SHUKeyGen/My Project/Resources.Designer.vb
generated
Normal file
62
DPMLizenzmanagement/SHUKeyGen/My Project/Resources.Designer.vb
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
'class via a tool like ResGen or Visual Studio.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SHUKeyGen.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
117
DPMLizenzmanagement/SHUKeyGen/My Project/Resources.resx
Normal file
117
DPMLizenzmanagement/SHUKeyGen/My Project/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
73
DPMLizenzmanagement/SHUKeyGen/My Project/Settings.Designer.vb
generated
Normal file
73
DPMLizenzmanagement/SHUKeyGen/My Project/Settings.Designer.vb
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
|
||||
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.SHUKeyGen.My.MySettings
|
||||
Get
|
||||
Return Global.SHUKeyGen.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
108
DPMLizenzmanagement/SHUKeyGen/SHUKeyGen.vbproj
Normal file
108
DPMLizenzmanagement/SHUKeyGen/SHUKeyGen.vbproj
Normal file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9C0E2055-23AC-4209-8C03-0364C5AF2BAB}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>SHUKeyGen</RootNamespace>
|
||||
<AssemblyName>SHUKeyGen</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>SHUKeyGen.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>SHUKeyGen.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="clsKeyGen.vb" />
|
||||
<Compile Include="Crypto.vb" />
|
||||
<Compile Include="KeyCode.vb" />
|
||||
<Compile Include="MD5_Crypt.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="StrFunc.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
396
DPMLizenzmanagement/SHUKeyGen/StrFunc.vb
Normal file
396
DPMLizenzmanagement/SHUKeyGen/StrFunc.vb
Normal file
@@ -0,0 +1,396 @@
|
||||
Module StrFunc
|
||||
'Attribute VB_Name = "StrFuncs"
|
||||
' *
|
||||
' * StrFuncs Module
|
||||
' * Copyright (C) 2007 John Mazza.
|
||||
' *
|
||||
' * Written by John Mazza <maz@mgcworks.com>
|
||||
' *
|
||||
' * This library is free software; you can redistribute it and/or
|
||||
' * modify it under the terms of the GNU Lesser General Public
|
||||
' * License Version 2.1 as published by the Free Software Foundation.
|
||||
' *
|
||||
' * This library is distributed in the hope that it will be useful,
|
||||
' * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
' * Lesser General Public License for more details.
|
||||
' *
|
||||
' * You should have received a copy of the GNU Lesser General Public
|
||||
' * License along with this library; if not, write to the Free Software
|
||||
' * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
' ****************************************************************************
|
||||
'
|
||||
' PURPOSE
|
||||
' String manipulation routines
|
||||
'
|
||||
' LANGUAGE
|
||||
' Visual Basic 6.0 or VBA6
|
||||
' Should work in VB.NET as well
|
||||
'
|
||||
' DEPENDENCIES:
|
||||
' None known
|
||||
'
|
||||
|
||||
|
||||
' Helper for Base32 numbers
|
||||
Const B32Map = "0123456789ABCDEFGHJKLMNPRSTVWXYZ"
|
||||
|
||||
|
||||
' General String Functions
|
||||
|
||||
' RemoveDashes() - Trivial function to delete "-" character from a string
|
||||
|
||||
Public Function RemoveDashes(ByVal StrIn As String) As String
|
||||
RemoveDashes = Replace(StrIn, "-", "")
|
||||
End Function
|
||||
|
||||
|
||||
' ShiftStrLeft() - Shift a string left by a number of bits
|
||||
|
||||
Public Function ShiftStrLeft(ByVal StrIn As String, ByVal Bits As Long) As String
|
||||
Dim CurPos As Long
|
||||
Dim WorkStr As String
|
||||
Dim RetStr As String
|
||||
Dim CurByteVal As Byte
|
||||
Dim BitMask As Byte
|
||||
Dim InvMask As Byte
|
||||
Dim ShiftBits As Byte
|
||||
Dim WholeBytes As Long
|
||||
Dim LeftPart As Byte
|
||||
Dim RightPart As Byte
|
||||
Dim Carry As Byte
|
||||
Dim PrevChar As Byte
|
||||
Dim TrimMask As Byte
|
||||
|
||||
Dim StrLen As Integer
|
||||
Dim StrBits As Integer
|
||||
|
||||
' Figure out some metrics on our input string
|
||||
|
||||
WholeBytes = Int(Bits / 8)
|
||||
ShiftBits = Bits Mod 8
|
||||
|
||||
BitMask = 255 - (2 ^ (8 - ShiftBits) - 1)
|
||||
InvMask = Not (BitMask)
|
||||
TrimMask = (2 ^ ShiftBits) - 1
|
||||
|
||||
CurPos = 1
|
||||
StrLen = Len(StrIn)
|
||||
StrBits = StrLen * 8
|
||||
WorkStr = StrIn
|
||||
|
||||
' Check we're not trying to shift more bits than
|
||||
' we have in the string.
|
||||
|
||||
If (StrBits > Bits) Then
|
||||
' First, shift string by whole bytes
|
||||
If (WholeBytes > 0) Then
|
||||
WorkStr = Right(WorkStr, StrLen - WholeBytes)
|
||||
|
||||
' Pad zero bytes to end of WorkStr to make length match
|
||||
|
||||
For CurPos = 1 To WholeBytes
|
||||
WorkStr = WorkStr & Chr(0)
|
||||
Next CurPos
|
||||
|
||||
' Ensure RetStr contains shifted string in case no other
|
||||
' bitwise shifting is performed later
|
||||
|
||||
RetStr = WorkStr
|
||||
End If
|
||||
|
||||
' Now handle the bitwise shift
|
||||
If (ShiftBits > 0) Then
|
||||
|
||||
For CurPos = 1 To Len(WorkStr)
|
||||
' Read next character of input and mask it appropriately
|
||||
CurByteVal = Asc(Mid(WorkStr, CurPos, 1))
|
||||
LeftPart = (CurByteVal And BitMask) And &HFF
|
||||
RightPart = (CurByteVal And InvMask) And &HFF
|
||||
|
||||
' Shift the masked portions
|
||||
LeftPart = Int(LeftPart / (2 ^ (8 - ShiftBits)))
|
||||
RightPart = (RightPart * (2 ^ ShiftBits))
|
||||
|
||||
If CurPos = 1 Then
|
||||
' Put the non-discarded part into PrevChar for later use
|
||||
PrevChar = (RightPart)
|
||||
RetStr = ""
|
||||
Else
|
||||
' Put carryover part into PrevChar and combine
|
||||
' the other bits with the carry from previous step
|
||||
PrevChar = PrevChar Or LeftPart
|
||||
RetStr = RetStr & Chr(PrevChar)
|
||||
PrevChar = RightPart
|
||||
End If
|
||||
|
||||
Next CurPos
|
||||
|
||||
' Combine our final carry with last char of string and mask off
|
||||
PrevChar = (PrevChar Or (LeftPart And Not (TrimMask)))
|
||||
RetStr = RetStr & Chr(PrevChar)
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
' If we're trying to shift by more bits than
|
||||
' input string, return an equal length string
|
||||
' full of zeroes (null characters).
|
||||
|
||||
For CurPos = 1 To StrLen
|
||||
RetStr = RetStr & Chr(0)
|
||||
Next CurPos
|
||||
End If
|
||||
|
||||
ShiftStrLeft = RetStr
|
||||
|
||||
End Function
|
||||
|
||||
' ShiftStringRight() - Shift a string right a number of bits
|
||||
|
||||
Public Function ShiftStrRight(ByVal StrIn As String, ByVal Bits As Long) As String
|
||||
Dim CurPos As Long
|
||||
Dim WorkStr As String
|
||||
Dim RetStr As String
|
||||
Dim CurByteVal As Byte
|
||||
Dim BitMask As Byte
|
||||
Dim InvMask As Byte
|
||||
Dim ShiftBits As Byte
|
||||
Dim WholeBytes As Long
|
||||
Dim LeftPart As Byte
|
||||
Dim RightPart As Byte
|
||||
Dim Carry As Byte
|
||||
Dim PrevChar As Byte
|
||||
Dim TrimMask As Byte
|
||||
|
||||
Dim StrLen As Integer
|
||||
Dim StrBits As Integer
|
||||
' Calculate metrics on input
|
||||
|
||||
WholeBytes = Int(Bits / 8)
|
||||
ShiftBits = Bits Mod 8
|
||||
|
||||
BitMask = 255 - ((2 ^ ShiftBits) - 1)
|
||||
InvMask = Not (BitMask)
|
||||
TrimMask = (2 ^ ShiftBits) - 1
|
||||
|
||||
CurPos = 1
|
||||
StrLen = Len(StrIn)
|
||||
StrBits = StrLen * 8
|
||||
|
||||
' Check we're not trying to shift more bits than
|
||||
' we have in the string.
|
||||
WorkStr = StrIn
|
||||
|
||||
If (StrBits > Bits) Then
|
||||
|
||||
' First, shift string by whole bytes
|
||||
|
||||
If (WholeBytes > 0) Then
|
||||
WorkStr = Left(WorkStr, StrLen - WholeBytes)
|
||||
|
||||
' Pad zero bytes to end of WorkStr
|
||||
|
||||
For CurPos = 1 To WholeBytes
|
||||
WorkStr = Chr(0) & WorkStr
|
||||
Next CurPos
|
||||
|
||||
' Ensure RetStr contains shifted string in case no other
|
||||
' bitwise shifting later
|
||||
|
||||
RetStr = WorkStr
|
||||
End If
|
||||
|
||||
' Now handle the bitwise shift
|
||||
If (ShiftBits > 0) Then
|
||||
|
||||
RetStr = ""
|
||||
|
||||
For CurPos = Len(WorkStr) To 1 Step -1
|
||||
|
||||
CurByteVal = Asc(Mid(WorkStr, CurPos, 1))
|
||||
|
||||
LeftPart = CurByteVal And BitMask
|
||||
LeftPart = LeftPart / (2 ^ ShiftBits)
|
||||
|
||||
RightPart = CurByteVal And InvMask
|
||||
RightPart = RightPart * (2 ^ (8 - ShiftBits))
|
||||
|
||||
If CurPos = Len(WorkStr) Then
|
||||
Carry = LeftPart
|
||||
Else
|
||||
CurByteVal = RightPart Or Carry
|
||||
Carry = LeftPart
|
||||
RetStr = Chr(CurByteVal) & RetStr
|
||||
End If
|
||||
|
||||
Next CurPos
|
||||
|
||||
RetStr = Chr(Carry) & RetStr
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
' If we're trying to shift by more bits than
|
||||
' input string, return an equal length string
|
||||
' full of zeroes.
|
||||
|
||||
For CurPos = 1 To StrLen
|
||||
RetStr = RetStr & Chr(0)
|
||||
Next CurPos
|
||||
End If
|
||||
|
||||
ShiftStrRight = RetStr
|
||||
|
||||
End Function
|
||||
|
||||
' Base32Enc() - Takes a "binary" string and represents as a Base32 number
|
||||
' Net result is an encoding where each "character" represents 5 bits
|
||||
|
||||
Public Function Base32Enc(ByVal StrIn As String) As String
|
||||
Dim CurBit As Long
|
||||
Dim Mask32 As Byte
|
||||
Dim CurPos As Long
|
||||
Dim CurVal As Byte
|
||||
Dim StrBits As Long
|
||||
Dim BitsProc As Long
|
||||
Dim WorkStr As String
|
||||
Dim RetStr As String
|
||||
Dim CurConv As String
|
||||
|
||||
Dim StrGroups As Integer
|
||||
Dim StrChar As Integer
|
||||
|
||||
RetStr = ""
|
||||
WorkStr = StrIn
|
||||
StrBits = Len(StrIn) * 8
|
||||
StrGroups = Int(StrBits / 5)
|
||||
|
||||
If (StrBits Mod 5) <> 0 Then StrGroups = StrGroups + 1
|
||||
|
||||
StrChar = Len(StrIn)
|
||||
BitsProc = 0
|
||||
Mask32 = &H1F
|
||||
|
||||
' Work from back of string to front.
|
||||
' and output the character representing each 5-bit group
|
||||
|
||||
For CurPos = 1 To StrGroups
|
||||
CurVal = Asc(Mid(WorkStr, Len(WorkStr), 1))
|
||||
CurVal = (CurVal And Mask32) + 1
|
||||
CurConv = Mid(B32Map, CurVal, 1)
|
||||
WorkStr = ShiftStrRight(WorkStr, 5)
|
||||
RetStr = CurConv & RetStr
|
||||
Next CurPos
|
||||
|
||||
Base32Enc = RetStr
|
||||
|
||||
End Function
|
||||
|
||||
' Base32Dec() - Takes a string encoded with Base32Enc() and returns the
|
||||
' original "binary" string it represents.
|
||||
|
||||
Public Function Base32Dec(ByVal StrIn As String) As String
|
||||
Dim CurPos As Long
|
||||
Dim CurVal As Byte
|
||||
Dim CurChr As String
|
||||
Dim RetStr As String
|
||||
Dim WorkStr As String
|
||||
Dim Carry As Byte
|
||||
Dim CarryMask As Byte
|
||||
Dim CurMask As Byte
|
||||
Dim ThisVal As Byte
|
||||
Dim ThisChar As String
|
||||
Dim ShiftBits As Long
|
||||
Dim OutBytes As Long
|
||||
Dim InBits As Long
|
||||
|
||||
' Calculate metrics
|
||||
Dim BitsProc As Integer
|
||||
Dim BaseMask As Object
|
||||
|
||||
BitsProc = 0
|
||||
BaseMask = &H1F
|
||||
Carry = 0
|
||||
WorkStr = StrIn
|
||||
|
||||
InBits = Len(StrIn) * 5
|
||||
OutBytes = Int(InBits / 8)
|
||||
|
||||
' Setup a string of zero bytes to push values into later
|
||||
|
||||
For CurPos = 1 To OutBytes
|
||||
RetStr = RetStr & Chr(0)
|
||||
Next CurPos
|
||||
|
||||
' Convert input string into binary representation
|
||||
|
||||
For CurPos = 1 To Len(StrIn)
|
||||
|
||||
' Derive 5-bit value of current char in StrIn
|
||||
CurChr = Mid(WorkStr, CurPos, 1)
|
||||
CurVal = InStr(1, B32Map, CurChr)
|
||||
CurVal = CurVal - 1
|
||||
|
||||
' Now, shift RetStr left 5 bits and pop last char off
|
||||
RetStr = ShiftStrLeft(RetStr, 5)
|
||||
ThisChar = Mid(RetStr, Len(RetStr), 1)
|
||||
RetStr = Left(RetStr, Len(RetStr) - 1)
|
||||
|
||||
' Now, OR our CurChr with the popped value
|
||||
' and push result back to end of string
|
||||
ThisVal = Asc(ThisChar)
|
||||
ThisVal = ThisVal Or CurVal
|
||||
ThisChar = Chr(ThisVal)
|
||||
RetStr = RetStr & ThisChar
|
||||
Next CurPos
|
||||
|
||||
Base32Dec = RetStr
|
||||
|
||||
End Function
|
||||
|
||||
' HexStrToBinStr() - Convert a hexadecimal string into a binary representation
|
||||
|
||||
Public Function HexStrToBinStr(ByVal StrIn As String) As String
|
||||
Dim StrOut As String
|
||||
Dim Ch As Long
|
||||
Dim HexByte As String
|
||||
Dim ByteVal As Long
|
||||
Dim ByteCh As String
|
||||
|
||||
StrOut = ""
|
||||
|
||||
For Ch = 1 To Len(StrIn) Step 2
|
||||
HexByte = Mid(StrIn, Ch, 2)
|
||||
ByteVal = Val("&H" & HexByte)
|
||||
ByteCh = Chr(ByteVal)
|
||||
StrOut = StrOut & ByteCh
|
||||
Next Ch
|
||||
|
||||
HexStrToBinStr = StrOut
|
||||
|
||||
End Function
|
||||
|
||||
' BinStrToHexStr() - Convert a binary string to a hexadecimal representation
|
||||
|
||||
Public Function BinStrToHexStr(ByVal StrIn As String) As String
|
||||
Dim StrOut As String
|
||||
Dim Ch As Long
|
||||
Dim HexByte As String
|
||||
Dim HexChr As String
|
||||
|
||||
StrOut = ""
|
||||
|
||||
For Ch = 1 To Len(StrIn)
|
||||
HexByte = Mid(StrIn, Ch, 1)
|
||||
HexChr = Hex$(Asc(HexByte))
|
||||
If Len(HexChr) = 1 Then HexChr = "0" & HexChr
|
||||
StrOut = StrOut & HexChr
|
||||
Next Ch
|
||||
|
||||
BinStrToHexStr = StrOut
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
End Module
|
||||
BIN
DPMLizenzmanagement/SHUKeyGen/bin/Debug/SHUKeyGen.dll
Normal file
BIN
DPMLizenzmanagement/SHUKeyGen/bin/Debug/SHUKeyGen.dll
Normal file
Binary file not shown.
BIN
DPMLizenzmanagement/SHUKeyGen/bin/Debug/SHUKeyGen.pdb
Normal file
BIN
DPMLizenzmanagement/SHUKeyGen/bin/Debug/SHUKeyGen.pdb
Normal file
Binary file not shown.
26
DPMLizenzmanagement/SHUKeyGen/bin/Debug/SHUKeyGen.xml
Normal file
26
DPMLizenzmanagement/SHUKeyGen/bin/Debug/SHUKeyGen.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
SHUKeyGen
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:SHUKeyGen.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SHUKeyGen.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SHUKeyGen.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
367
DPMLizenzmanagement/SHUKeyGen/clsKeyGen.vb
Normal file
367
DPMLizenzmanagement/SHUKeyGen/clsKeyGen.vb
Normal file
@@ -0,0 +1,367 @@
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Public Class clsKeyGen
|
||||
Dim m_demomode As Boolean
|
||||
Property DemoMode As Boolean
|
||||
Get
|
||||
Return m_demomode
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_demomode = value
|
||||
End Set
|
||||
End Property
|
||||
Dim m_delimiter As String
|
||||
Property Delimiter As String
|
||||
Get
|
||||
Return m_delimiter
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_delimiter = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_cryptokey As String
|
||||
Property Cryptokey As String
|
||||
Get
|
||||
Return m_cryptokey
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_cryptokey = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_lizenznehmer As String
|
||||
Property Lizenznahmer As String
|
||||
Get
|
||||
Return m_lizenznehmer
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_lizenznehmer = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_seriennummer As String
|
||||
Property Seriennummer As String
|
||||
Get
|
||||
Return m_seriennummer
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_seriennummer = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_Produktname As String
|
||||
Property Produktname As String
|
||||
Get
|
||||
Return m_Produktname
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Produktname = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_Gueltigbis As DateTime
|
||||
Property Gueltigbis As DateTime
|
||||
Get
|
||||
Return m_Gueltigbis
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_Gueltigbis = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_lizenzgeber As String
|
||||
Property Lizenzgeber As String
|
||||
Get
|
||||
Return m_lizenzgeber
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_lizenzgeber = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_option1 As Boolean
|
||||
Dim m_option2 As Boolean
|
||||
Dim m_option3 As Boolean
|
||||
Dim m_option4 As Boolean
|
||||
Dim m_option5 As Boolean
|
||||
Dim m_option6 As Boolean
|
||||
|
||||
Property Option1 As Boolean
|
||||
Get
|
||||
Return m_option1
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_option1 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property Option2 As Boolean
|
||||
Get
|
||||
Return m_option2
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_option2 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property Option3 As Boolean
|
||||
Get
|
||||
Return m_option3
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_option3 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property Option4 As Boolean
|
||||
Get
|
||||
Return m_option4
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_option4 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property Option5 As Boolean
|
||||
Get
|
||||
Return m_option5
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_option5 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property Option6 As Boolean
|
||||
Get
|
||||
Return m_option6
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_option6 = value
|
||||
If m_option6 = True Then Me.DemoMode = True
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_keycode As String
|
||||
Property KeyCode As String
|
||||
Get
|
||||
Return m_keycode
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_keycode = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_status As String
|
||||
Property Status As String
|
||||
Get
|
||||
Return m_status
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_status = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim tempkeycode As Object
|
||||
Dim rawkey As Object
|
||||
Dim binkey As Object
|
||||
|
||||
Sub New(Optional Lizenznehmer As String = "", Optional Seriennummer As String = "", Optional Produktname As String = "", Optional Gueltigbis As String = "", Optional Lizenzgeber As String = "", Optional Delimiter As String = "", Optional Cryptostring As String = "")
|
||||
Try
|
||||
Me.Lizenznahmer = Lizenznehmer
|
||||
Me.Seriennummer = Seriennummer
|
||||
Me.Produktname = Produktname
|
||||
Me.Lizenzgeber = Lizenzgeber
|
||||
Me.Delimiter = Delimiter
|
||||
Me.Cryptokey = Cryptostring
|
||||
Me.Gueltigbis = Gueltigbis
|
||||
Catch
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
Sub GenNewKey()
|
||||
Try
|
||||
Dim FeatID As Long
|
||||
|
||||
FeatID = 0
|
||||
Dim UsernameT As String
|
||||
Dim ProdNameT As String
|
||||
|
||||
'Build bitmap from checkboxes
|
||||
If Me.Option1 Then FeatID = FeatID Or 1
|
||||
If Me.Option2 Then FeatID = FeatID Or 2
|
||||
If Me.Option3 Then FeatID = FeatID Or 4
|
||||
If Me.Option4 Then FeatID = FeatID Or 8
|
||||
If Me.Option5 Then FeatID = FeatID Or 16
|
||||
If Me.Option6 Then FeatID = FeatID Or 32
|
||||
|
||||
UsernameT = Trim(Me.Lizenznahmer)
|
||||
ProdNameT = Trim(Me.Seriennummer)
|
||||
|
||||
If Not (UsernameT = "") Or Not (ProdNameT = "") Then
|
||||
rawkey = GenKeyString(Trim(Lizenznahmer), Trim(Seriennummer) & Trim(Produktname), FeatID)
|
||||
'rawkey = GenKeyString(UsernameT, ProdNameT & Me.txtProductName.Text + Me.DateTimePicker1.ToString, FeatID)
|
||||
binkey = HexStrToBinStr(rawkey)
|
||||
Me.KeyCode = FormatKeyCode(Base32Enc(binkey), 4)
|
||||
Me.Status = "Key generated"
|
||||
Else
|
||||
Me.KeyCode = "n.a."
|
||||
Me.Status = "Key generation error"
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Me.Status = "Key generation error"
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Sub Save_Licensefile()
|
||||
Try
|
||||
Dim sd As New SaveFileDialog
|
||||
sd.Filter = "Key-Files|*.key|All files|*.*"
|
||||
sd.FilterIndex = 0
|
||||
If sd.ShowDialog <> DialogResult.OK Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim Cryptedstring = Me.Lizenznahmer + Me.Delimiter + Seriennummer + Delimiter + Me.Gueltigbis.ToShortDateString + Delimiter + Me.Lizenzgeber + Delimiter + Me.Produktname
|
||||
binkey = binkey + Delimiter + Cryptedstring
|
||||
binkey = Crypto.EncryptText(binkey, Cryptokey)
|
||||
Me.Status = "File: " + sd.FileName + " saved"
|
||||
Dim fs As System.IO.FileStream
|
||||
fs = New System.IO.FileStream(sd.FileName, System.IO.FileMode.Create)
|
||||
Dim b As Byte()
|
||||
b = UnicodeStringToBytes(binkey)
|
||||
fs.Write(b, 0, b.Length)
|
||||
fs.Close()
|
||||
sd.Dispose()
|
||||
Catch
|
||||
Me.Status = "Save file error"
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Function UnicodeStringToBytes(ByVal str As String) As Byte()
|
||||
Return System.Text.Encoding.Unicode.GetBytes(str)
|
||||
End Function
|
||||
|
||||
Private Function UnicodeBytesToString(
|
||||
ByVal bytes() As Byte) As String
|
||||
Return System.Text.Encoding.Unicode.GetString(bytes)
|
||||
End Function
|
||||
|
||||
#Region "GetFile"
|
||||
Dim features As Object
|
||||
Public Sub Read_LicenseFile(ByVal Filename As String)
|
||||
|
||||
Dim od As New OpenFileDialog
|
||||
If Filename = "" Then
|
||||
od.Filter = "Key-Files|*.key|All files|*.*"
|
||||
od.FilterIndex = 0
|
||||
If od.ShowDialog <> DialogResult.OK Then
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
If System.IO.File.Exists(Filename) Then
|
||||
od.FileName = Filename
|
||||
Else
|
||||
Me.Status = "KeyFile not found."
|
||||
Me.DemoMode = True
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim fInfo As New System.IO.FileInfo(od.FileName)
|
||||
Dim numBytes As Long = fInfo.Length
|
||||
Dim fs As New FileStream(od.FileName, FileMode.Open, FileAccess.Read)
|
||||
Dim br As New System.IO.BinaryReader(fs)
|
||||
Dim bytes As Byte() = br.ReadBytes(CInt(numBytes))
|
||||
|
||||
Dim s As String
|
||||
s = UnicodeBytesToString(bytes)
|
||||
s = Crypto.DecryptText(s, Me.Cryptokey)
|
||||
Dim splitter As String()
|
||||
splitter = s.Split(Me.Delimiter)
|
||||
Me.KeyCode = FormatKeyCode(Base32Enc(splitter(0)), 4)
|
||||
Me.Lizenznahmer = splitter(2)
|
||||
Me.Seriennummer = splitter(4)
|
||||
Me.Gueltigbis = splitter(6)
|
||||
Me.Lizenzgeber = splitter(8)
|
||||
Me.Produktname = splitter(10)
|
||||
|
||||
If IsKeyValid(Me.KeyCode, Me.Lizenznahmer, Me.Seriennummer) Then
|
||||
features = GetKeyFeat(Me.KeyCode, Me.Lizenznahmer, Me.Seriennummer)
|
||||
DoCheckBoxes(features)
|
||||
Me.Status = "Fileread OK"
|
||||
Else
|
||||
Me.Status = "License is not valid."
|
||||
Me.DemoMode = True
|
||||
End If
|
||||
|
||||
br.Close()
|
||||
fs.Close()
|
||||
od.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Function IsKeyValid(ByVal KeyCode As String, ByVal UserName As String, ByVal ProdName As String) As Boolean
|
||||
Dim BinKey As String
|
||||
Dim IsValid As Boolean
|
||||
Dim HexKey As String
|
||||
|
||||
IsValid = False
|
||||
|
||||
' First, decode Base32 string into binary one
|
||||
' Remove any dashes in input string
|
||||
|
||||
BinKey = Base32Dec(RemoveDashes(KeyCode))
|
||||
|
||||
HexKey = BinStrToHexStr(BinKey)
|
||||
IsValid = ValidateKeyCode(HexKey, Me.Lizenznahmer, Me.Seriennummer & Me.Produktname)
|
||||
|
||||
|
||||
IsKeyValid = IsValid
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Dim Isvalid As Boolean
|
||||
Private Function GetKeyFeat(ByVal KeyCode As String, UserName As String, ProdName As String) As Long
|
||||
Dim BinKey As String
|
||||
Dim FeatBMP As Long
|
||||
Dim HexKey As String
|
||||
|
||||
Isvalid = False
|
||||
|
||||
' First, decode Base32 string into binary one
|
||||
' Remove any dashes in input string
|
||||
|
||||
BinKey = Base32Dec(RemoveDashes(KeyCode))
|
||||
|
||||
' Check length of BinKey - must be 16 to be valid
|
||||
If Len(BinKey) = 16 Then
|
||||
HexKey = BinStrToHexStr(BinKey)
|
||||
FeatBMP = ExtractKeyFBits(HexKey, Me.Lizenznahmer, Me.Seriennummer & Me.Produktname)
|
||||
Else
|
||||
FeatBMP = 0
|
||||
End If
|
||||
|
||||
GetKeyFeat = FeatBMP
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub DoCheckBoxes(ByVal ChkVal As Long)
|
||||
Me.Option1 = ChkVal And 1
|
||||
Me.Option2 = (ChkVal And 2) / 2
|
||||
Me.Option3 = (ChkVal And 4) / 4
|
||||
Me.Option4 = (ChkVal And 8) / 8
|
||||
Me.Option5 = (ChkVal And 16) / 16
|
||||
Me.Option6 = (ChkVal And 32) / 32
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Binary file not shown.
Binary file not shown.
BIN
DPMLizenzmanagement/SHUKeyGen/obj/Debug/SHUKeyGen.dll
Normal file
BIN
DPMLizenzmanagement/SHUKeyGen/obj/Debug/SHUKeyGen.dll
Normal file
Binary file not shown.
BIN
DPMLizenzmanagement/SHUKeyGen/obj/Debug/SHUKeyGen.pdb
Normal file
BIN
DPMLizenzmanagement/SHUKeyGen/obj/Debug/SHUKeyGen.pdb
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
3199ede46b0738d56294ca8ad1362ea89d39dec0
|
||||
@@ -0,0 +1,19 @@
|
||||
E:\Software-Projekte\_Demos\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.Resources.resources
|
||||
E:\Software-Projekte\_Demos\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.vbproj.GenerateResource.cache
|
||||
E:\Software-Projekte\_Demos\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.vbproj.CoreCompileInputs.cache
|
||||
E:\Software-Projekte\_Demos\DPMLizenzmanagement\SHUKeyGen\bin\Debug\SHUKeyGen.dll
|
||||
E:\Software-Projekte\_Demos\DPMLizenzmanagement\SHUKeyGen\bin\Debug\SHUKeyGen.pdb
|
||||
E:\Software-Projekte\_Demos\DPMLizenzmanagement\SHUKeyGen\bin\Debug\SHUKeyGen.xml
|
||||
E:\Software-Projekte\_Demos\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.dll
|
||||
E:\Software-Projekte\_Demos\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.xml
|
||||
E:\Software-Projekte\_Demos\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.pdb
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\bin\Debug\SHUKeyGen.dll
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\bin\Debug\SHUKeyGen.pdb
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\bin\Debug\SHUKeyGen.xml
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.vbprojResolveAssemblyReference.cache
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.Resources.resources
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.vbproj.GenerateResource.cache
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.vbproj.CoreCompileInputs.cache
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.dll
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.xml
|
||||
E:\Software-Projekte\DPM\DPM2016\DPMLizenzmanagement\SHUKeyGen\obj\Debug\SHUKeyGen.pdb
|
||||
Binary file not shown.
Binary file not shown.
26
DPMLizenzmanagement/SHUKeyGen/obj/Debug/SHUKeyGen.xml
Normal file
26
DPMLizenzmanagement/SHUKeyGen/obj/Debug/SHUKeyGen.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
SHUKeyGen
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:SHUKeyGen.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SHUKeyGen.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:SHUKeyGen.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
3199ede46b0738d56294ca8ad1362ea89d39dec0
|
||||
Binary file not shown.
Reference in New Issue
Block a user