[ActiveLock-Development] CVS: activelock2/test ALTestApp.vbp,1.8,1.9 frmMain.frm,1.9,1.10 modMain.ba
Brought to you by:
ialkan
From: Thanh H. T. <th...@us...> - 2003-08-04 13:48:09
|
Update of /cvsroot/activelock/activelock2/test In directory sc8-pr-cvs1:/tmp/cvs-serv3247 Modified Files: ALTestApp.vbp frmMain.frm modMain.bas frmMain.frx Log Message: Added SoftwareCode generator and usage instructions. Index: ALTestApp.vbp =================================================================== RCS file: /cvsroot/activelock/activelock2/test/ALTestApp.vbp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ALTestApp.vbp 4 Aug 2003 11:08:04 -0000 1.8 +++ ALTestApp.vbp 4 Aug 2003 13:48:05 -0000 1.9 @@ -7,6 +7,7 @@ Module=modMain; modMain.bas Module=modActiveLock; ..\src\modActiveLock.bas ResFile32="atDisplay.RES" +Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; COMCTL32.OCX IconForm="frmMain" Startup="frmMain" HelpFile="" Index: frmMain.frm =================================================================== RCS file: /cvsroot/activelock/activelock2/test/frmMain.frm,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- frmMain.frm 4 Aug 2003 01:34:02 -0000 1.9 +++ frmMain.frm 4 Aug 2003 13:48:05 -0000 1.10 @@ -1,18 +1,39 @@ VERSION 5.00 Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX" +Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX" Begin VB.Form frmMain BorderStyle = 3 'Fixed Dialog Caption = "ActiveLock2 Test App" - ClientHeight = 6270 + ClientHeight = 6615 ClientLeft = 45 ClientTop = 330 ClientWidth = 8025 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False - ScaleHeight = 6270 + ScaleHeight = 6615 ScaleWidth = 8025 StartUpPosition = 3 'Windows Default + Begin ComctlLib.StatusBar sbStatus + Align = 2 'Align Bottom + Height = 255 + Left = 0 + TabIndex = 56 + Top = 6360 + Width = 8025 + _ExtentX = 14155 + _ExtentY = 450 + Style = 1 + SimpleText = "Ready" + _Version = 327682 + BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} + NumPanels = 1 + BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} + Key = "" + Object.Tag = "" + EndProperty + EndProperty + End Begin TabDlg.SSTab SSTab1 Height = 6255 Left = 0 @@ -42,27 +63,31 @@ Tab(0).Control(6).Enabled= 0 'False Tab(0).Control(7)= "Label14" Tab(0).Control(7).Enabled= 0 'False - Tab(0).Control(8)= "cmdSoftwareCodeGen" + Tab(0).Control(8)= "Label15" Tab(0).Control(8).Enabled= 0 'False - Tab(0).Control(9)= "cmbLicClass" + Tab(0).Control(9)= "cmdSoftwareCodeGen" Tab(0).Control(9).Enabled= 0 'False - Tab(0).Control(10)= "txtName" + Tab(0).Control(10)= "cmbLicClass" Tab(0).Control(10).Enabled= 0 'False - Tab(0).Control(11)= "txtVersion" + Tab(0).Control(11)= "txtName" Tab(0).Control(11).Enabled= 0 'False - Tab(0).Control(12)= "txtSoftwareCodePriv" + Tab(0).Control(12)= "txtVersion" Tab(0).Control(12).Enabled= 0 'False - Tab(0).Control(13)= "txtSoftwareCodePub" + Tab(0).Control(13)= "txtSoftwareCodePriv" Tab(0).Control(13).Enabled= 0 'False - Tab(0).Control(14)= "cmbLicType" + Tab(0).Control(14)= "txtSoftwareCodePub" Tab(0).Control(14).Enabled= 0 'False - Tab(0).Control(15)= "txtDays" + Tab(0).Control(15)= "cmbLicType" Tab(0).Control(15).Enabled= 0 'False - Tab(0).Control(16)= "fraKeyGen" + Tab(0).Control(16)= "txtDays" Tab(0).Control(16).Enabled= 0 'False - Tab(0).Control(17)= "txtChecksum" + Tab(0).Control(17)= "fraKeyGen" Tab(0).Control(17).Enabled= 0 'False - Tab(0).ControlCount= 18 + Tab(0).Control(18)= "txtChecksum" + Tab(0).Control(18).Enabled= 0 'False + Tab(0).Control(19)= "Text1" + Tab(0).Control(19).Enabled= 0 'False + Tab(0).ControlCount= 20 TabCaption(1) = "Registration" TabPicture(1) = "frmMain.frx":001C Tab(1).ControlEnabled= 0 'False @@ -76,6 +101,16 @@ Tab(2).Control(1)= "fraViewport" Tab(2).Control(2)= "fraTicker" Tab(2).ControlCount= 3 + Begin VB.TextBox Text1 + BackColor = &H80000011& + Height = 1455 + Left = 120 + MultiLine = -1 'True + TabIndex = 57 + Text = "frmMain.frx":0054 + Top = 4680 + Width = 7695 + End Begin VB.TextBox txtChecksum BackColor = &H80000011& Height = 285 @@ -87,10 +122,10 @@ End Begin VB.Frame fraKeyGen Caption = "Key Generator" - Height = 2415 + Height = 1335 Left = 120 TabIndex = 43 - Top = 3360 + Top = 3000 Width = 7455 Begin VB.TextBox txtReqCodeIn Height = 285 @@ -109,9 +144,11 @@ End Begin VB.CommandButton cmdKeyGen Caption = "Generat&e" + Enabled = 0 'False Height = 255 Left = 6360 TabIndex = 44 + ToolTipText = "Generate liberation key for the above request code (which should not be blank)." Top = 600 Width = 975 End @@ -139,17 +176,17 @@ Locked = -1 'True TabIndex = 40 Text = "30" - Top = 2445 + Top = 2325 Width = 1215 End Begin VB.ComboBox cmbLicType Height = 315 - ItemData = "frmMain.frx":0054 + ItemData = "frmMain.frx":01CA Left = 1320 - List = "frmMain.frx":0061 + List = "frmMain.frx":01D7 Style = 2 'Dropdown List TabIndex = 3 - Top = 2160 + Top = 2040 Width = 5055 End Begin VB.TextBox txtSoftwareCodePub @@ -216,9 +253,9 @@ End Begin VB.ComboBox cboSpeed Height = 315 - ItemData = "frmMain.frx":0087 + ItemData = "frmMain.frx":01FD Left = 2070 - List = "frmMain.frx":009A + List = "frmMain.frx":0210 Style = 2 'Dropdown List TabIndex = 29 Top = 270 @@ -309,7 +346,7 @@ TickerFontSize = 11.25 TickerFlash = 0 'False TickerPlaySound = 0 'False - TickerScrollX = 518 + TickerScrollX = 473 BalloonTipIcon = 0 BalloonTipText = "No Messages" End @@ -327,7 +364,7 @@ MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 19 - Text = "frmMain.frx":00C4 + Text = "frmMain.frx":023A Top = 240 Width = 7425 End @@ -342,7 +379,7 @@ End Begin VB.Frame fraRegStatus Caption = "Status" - Height = 2655 + Height = 2175 Left = -74880 TabIndex = 11 Top = 480 @@ -433,6 +470,7 @@ End Begin VB.CommandButton cmdRegister Caption = "&Register" + Enabled = 0 'False Height = 255 Left = 6480 TabIndex = 10 @@ -473,22 +511,30 @@ End Begin VB.ComboBox cmbLicClass Height = 315 - ItemData = "frmMain.frx":0136 + ItemData = "frmMain.frx":02AC Left = 1320 - List = "frmMain.frx":0146 + List = "frmMain.frx":02BC Style = 2 'Dropdown List TabIndex = 4 - Top = 2730 + Top = 2610 Width = 5055 End Begin VB.CommandButton cmdSoftwareCodeGen Caption = "&Generate" - Enabled = 0 'False Height = 255 Left = 6480 TabIndex = 2 + ToolTipText = $"frmMain.frx":033F Top = 1560 - Width = 1215 + Width = 1335 + End + Begin VB.Label Label15 + Caption = "Instructions:" + Height = 495 + Left = 120 + TabIndex = 58 + Top = 4440 + Width = 1935 End Begin VB.Label Label14 Caption = "ActiveLock's Checksum:" @@ -503,7 +549,7 @@ Height = 255 Left = 2640 TabIndex = 42 - Top = 2490 + Top = 2370 Width = 1335 End Begin VB.Label lblExpiry @@ -511,7 +557,7 @@ Height = 255 Left = 120 TabIndex = 41 - Top = 2445 + Top = 2325 Width = 1335 End Begin VB.Label Label10 @@ -535,7 +581,7 @@ Height = 255 Left = 120 TabIndex = 6 - Top = 2730 + Top = 2610 Width = 1335 End Begin VB.Label Label2 @@ -543,7 +589,7 @@ Height = 255 Left = 120 TabIndex = 5 - Top = 2160 + Top = 2040 Width = 1335 End Begin VB.Label Label1 @@ -614,6 +660,7 @@ ' ' 07.31.03 - th2tran - Now performing checksum on ActiveLock2.dll. ' 08.01.03 - wizzardme2000 - LockTypes other than MAC are now supported +' 08.03.03 - th2tran - Added SoftwareCode generator and usage instructions. ' ' /////////////////////////////////////////////////////////////////////// ' / MODULE CODE BEGINS BELOW THIS LINE / @@ -626,6 +673,55 @@ Attribute ActiveLockEventSink.VB_VarHelpID = -1 +Private Sub cmdSoftwareCodeGen_Click() + Screen.MousePointer = vbHourglass + txtSoftwareCodePub = "" + txtSoftwareCodePriv = "" + Enabled = False + DoEvents + On Error GoTo Done + Dim Key As RSAKey + Dim progress As ProgressType + ' generate the key + modActiveLock.rsa_generate Key, 1024, AddressOf ProgressUpdate, VarPtr(progress) + ' extract private and public key blobs + Dim strBlob As String + Dim blobLen As Long + rsa_public_key_blob Key, vbNullString, blobLen + If blobLen > 0 Then + strBlob = String(blobLen, 0) + rsa_public_key_blob Key, strBlob, blobLen + Debug.Print "Public blob: " & strBlob + txtSoftwareCodePub = strBlob + End If + + modActiveLock.rsa_private_key_blob Key, vbNullString, blobLen + If blobLen > 0 Then + strBlob = String(blobLen, 0) + modActiveLock.rsa_private_key_blob Key, strBlob, blobLen + Debug.Print "Private blob: " & strBlob + txtSoftwareCodePriv = strBlob + End If + ' done with the key - throw it away + modActiveLock.rsa_freekey Key + + ' Test generated key for correctness by recreating it from the blobs + ' Note: + ' ==== + ' Due to an outstanding bug in ALCrypto.dll, sometimes this step will crash the app because + ' the generated keyset is bad. + ' The work-around for the time being is to keep regenerating the keyset until eventually + ' you'll get a valid keyset that no longer crashes. + Dim strData$: strData = "This is a test string to be encrypted." + modActiveLock.rsa_createkey txtSoftwareCodePub, Len(txtSoftwareCodePub), _ + txtSoftwareCodePriv, Len(txtSoftwareCodePriv), Key + ' It worked! We're all set to go. + modActiveLock.rsa_freekey Key +Done: + Screen.MousePointer = vbDefault + Enabled = True +End Sub + ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' ActiveLock Initialization ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' @@ -934,10 +1030,18 @@ End If End Sub +Private Sub txtLibKeyIn_Change() + cmdRegister.Enabled = CBool(Trim$(txtLibKeyIn.Text) <> "") +End Sub + Private Sub txtName_Change() MyActiveLock.SoftwareName = txtName End Sub +Private Sub txtReqCodeIn_Change() + cmdKeyGen.Enabled = CBool(Trim$(txtReqCodeIn.Text) <> "") +End Sub + Private Sub txtSoftwareCodePub_Change() MyActiveLock.SoftwareCode = txtSoftwareCodePub End Sub @@ -946,3 +1050,6 @@ MyActiveLock.SoftwareVersion = txtVersion End Sub +Public Sub UpdateStatus(Txt As String) + sbStatus.SimpleText = Txt +End Sub Index: modMain.bas =================================================================== RCS file: /cvsroot/activelock/activelock2/test/modMain.bas,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- modMain.bas 4 Aug 2003 12:14:05 -0000 1.9 +++ modMain.bas 4 Aug 2003 13:48:05 -0000 1.10 @@ -245,3 +245,10 @@ End If VerifyActiveLockdll = CStr(crc) End Function + +'' +' Callback function for rsa_generate() +' +Public Sub ProgressUpdate(ByVal param As Long, ByVal action As Long, ByVal phase As Long, ByVal iprogress As Long) + frmMain.UpdateStatus "Progress Update received " & param & ", action: " & action & ", iprogress: " & iprogress +End Sub Index: frmMain.frx =================================================================== RCS file: /cvsroot/activelock/activelock2/test/frmMain.frx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 Binary files /tmp/cvsMNVrQB and /tmp/cvsIPiXv3 differ |