[ActiveLock-Development] CVS: alugen/lib Generator.cls,1.3,1.4 IALUGenerator.cls,1.3,1.4 alugen.dll,
Brought to you by:
ialkan
From: Thanh H. T. <th...@us...> - 2003-11-03 06:40:49
|
Update of /cvsroot/activelock/alugen/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30129 Modified Files: Generator.cls IALUGenerator.cls alugen.dll Log Message: Interface changed. Index: Generator.cls =================================================================== RCS file: /cvsroot/activelock/alugen/lib/Generator.cls,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Generator.cls 13 Oct 2003 05:43:43 -0000 1.3 +++ Generator.cls 3 Nov 2003 06:40:45 -0000 1.4 @@ -65,6 +65,7 @@ ' 09.21.03 - th2tran - Implemented IALUGenerator_RetrieveProduct() ' - Finished implementing IALUGenerator_GenKey() ' - Dumped ActiveLockEventNotifier. Don't neeed it here. +' 11.02.03 - th2tran - Re-implemented IALUGenerator_GenKey() - interface changed ' ' </pre> @@ -155,17 +156,18 @@ MyIniFile.File = RHS End Property -Private Function IALUGenerator_GenKey(ActiveLock As ActiveLock2.IActiveLock, ByVal ReqCode As String, ExpireDate As String) As String +Private Function IALUGenerator_GenKey(Lic As ActiveLock2.ProductLicense, ByVal InstCode As String) As String ' Take request code and decrypt it. Dim strReq As String - strReq = ActiveLock2.Base64Decode(ReqCode) - ' strReq now contains the {MAC + vbLf + User} string + strReq = ActiveLock2.Base64Decode(InstCode) + ' strReq now contains the {LockCode + vbLf + User} string Dim strLock$, strUser$ - GetLockAndUserFromRequestCode strReq, strLock, strUser - + GetLockAndUserFromInstallCode strReq, strLock, strUser + Lic.Licensee = strUser ' registration date Dim strRegDate As String - strRegDate = Format(Now(), "yyyy/mm/dd") + strRegDate = Lic.RegisteredDate + Dim strEncrypted As String ' @todo Rethink this bit about encrypting the dates. ' We need to keep in mind that the app does not have access to the private key, so and any decryption that requires private key @@ -175,26 +177,22 @@ ' hash it 'strEncrypted = ActiveLock2.MD5Hash(strEncrypted) strEncrypted = strRegDate - + ' get software codes Dim ProdInfo As ProductInfo - Set ProdInfo = IALUGenerator_RetrieveProduct(ActiveLock.SoftwareName, ActiveLock.SoftwareVersion) - + Set ProdInfo = IALUGenerator_RetrieveProduct(Lic.ProductName, Lic.ProductVer) + Lic.ProductKey = ProdInfo.VCode + '@todo Check for "ProdInfo Is Nothing" and handle appropriately - - Dim Lic As ProductLicense - With ActiveLock - Set Lic = ActiveLock2.CreateProductLicense(ProdInfo.Name, ProdInfo.VCode, _ - ProdInfo.Version, .LockType, .LicenseType, strUser, ExpireDate, , strRegDate, strEncrypted) - End With + Dim strLic As String - ' encrypt Product license using the MAC - strLic = MyActiveLock.LockCode(Lic) & vbLf & strLock + ' Encrypt Product license using the MAC + strLic = Lic.ToString() & vbLf & strLock Debug.Print "strLic: " & vbCrLf & strLic ' sign it - Dim strSig As String + Dim strSig As String: strSig = String(1024, 0) strSig = ActiveLock2.RSASign(ProdInfo.VCode, ProdInfo.GCode, strLic) - + ' Create liberation key. This will be a base-64 encoded string of the whole license. Dim strLicKey As String strLicKey = ActiveLock2.Base64Encode(strSig) @@ -208,7 +206,7 @@ Debug.Print "Sig: " & strSig Debug.Print "Verify: " & ActiveLock2.RSAVerify(ProdInfo.VCode, strLic, ActiveLock2.Base64Decode(strLicKey)) Debug.Print "====================================================" - + ' Serialize it into a formatted string Dim strLibKey As String Lic.Save strLibKey @@ -218,16 +216,16 @@ '' ' Retrieves lock string and user info from the request string ' -Private Sub GetLockAndUserFromRequestCode(ByVal strReq As String, ByRef strLock As String, ByRef strUser As String) +Private Sub GetLockAndUserFromInstallCode(ByVal strReq As String, ByRef strLock As String, ByRef strUser As String) Dim Index%, i - + For i = 1 To Len(strReq) If Mid(strReq, i, 1) = vbLf Then Index = i Next i - + Index = InStr(1, strReq, vbLf) If Index <= 0 Then Exit Sub - + strLock = Left(strReq, Index - 1) strUser = Mid$(strReq, Index + 1) strUser = TrimNulls(strUser) Index: IALUGenerator.cls =================================================================== RCS file: /cvsroot/activelock/alugen/lib/IALUGenerator.cls,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- IALUGenerator.cls 13 Oct 2003 05:43:43 -0000 1.3 +++ IALUGenerator.cls 3 Nov 2003 06:40:45 -0000 1.4 @@ -68,6 +68,10 @@ ' to ' GenKey(objActiveLock As IActiveLock, ByVal ReqCode As String, ExpireDate As String) ' 10.13.03 - th2tran - Renamed Code1 and Code2 to VCode and GCode respectively. +' 11.02.03 - th2tran - GenKey interface changed (again) from + GenKey(objActiveLock As IActiveLock, ByVal ReqCode As String, ExpireDate As String) As String + to + GenKey(Lic As ActiveLock2.ProductLicense, ByVal InstCode As String) As String ' </pre> ' /////////////////////////////////////////////////////////////////////// @@ -106,7 +110,7 @@ ' Public Function RetrieveProduct(ByVal Name As String, ByVal Ver As String) As ProductInfo Attribute RetrieveProduct.VB_Description = "Retrieves product information." - + End Function '' @@ -133,11 +137,10 @@ '' ' Generates liberation key for the specified product. ' -' @param objActiveLock ActiveLock object. Needed for software name, version, code, etc... -' @param ReqCode Key Request Code -' @param ExpireDate Expiration Date +' @param Lic License object for which to generate the liberation key. +' @param InstCode User installation code ' -Public Function GenKey(objActiveLock As IActiveLock, ByVal ReqCode As String, ExpireDate As String) As String +Public Function GenKey(Lic As ActiveLock2.ProductLicense, ByVal InstCode As String) As String Attribute GenKey.VB_Description = "Generates liberation key for the specified product." End Function Index: alugen.dll =================================================================== RCS file: /cvsroot/activelock/alugen/lib/alugen.dll,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 Binary files /tmp/cvsPIK0Jb and /tmp/cvs6kJZ3c differ |