Join 150,194 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,032 people online right now. Registration is fast and FREE... Join Now!
i have the clslock but i need to reference it to get it to work any ideas
A new class clsLock provides: 1) Encryption 2) Decryption 3) Key Setting from String
The model used is the Triple DES (Data Encryption Standard)
This requires a 24 Byte Key and an 8 Byte Initialization Vector
Both must be known to decrypt
The IV is fixed in the class, but the Key can be changed via KeyFromString Function.
This way a specific key could be used by an application.
The idea is to encrypt things like passwords or other sensitive data in varbinary columns in the database. SQL provides its own encryption but it is generally considered to be weak
Applications can freely use the data but no query, Access or alien application can read the data without knowing
1) The encryption scheme, 2) The 24 byte key as its string or byte version 3) The 8 byte vector
We are protecting the source code and implementing the class as a standalone DLL, so the details are in compiled code and in secured source
can anyone help with this. i have the key and stuff in a dll file and i just need someone to help me figure out how to refer to it
Could you post your current code? Or are you so lost that you haven't yet added a reference to the dll in your project? Click add refrence and browse for the .dll then see if you can declare an instance of your class. Good practice would be to include the encryption project in the main project so it gets compiled everytime chages are made and so that you can easily debug the class.
i have added the reference for the dll. after that im not sure what to do and thats where im stuck. any help would be great as i am new to .net
Okay in the encryption dll project open up the project properties by dlb clicking on My Project in the solution explorer. Now select the Application tab and make note of the Root namespace, for this example I will assume it is 'DLLEncryption'. Now go back to your main project and try this...
CODE
Dim MyEncryption as New DLLEncryption.MyEncryptionClass
You can also browse the object explorer in your main project by pressing CTRL-ALT-J. From this window you can see all your referenced assemblies and their classes. Right click on the encryption class you want to reference, select COPY and then you can PASTE it into your code.
End Sub Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click If Me.editCheck() = True Then
Dim MyEncryption As New CIMABank.MyEncryption Me._data.UpdateFromTable(Me._mailSetup) Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close()
End If End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub
Private Function editCheck() As Boolean 'check for completeness 'called after OK button is hit Dim blnOK As Boolean = True Dim strMessage As String = ""
If String.IsNullOrEmpty(Me.txtMailKey.Text.Trim) Then blnOK = False strMessage &= "Password Cannot be blank" & vbCrLf Else If String.IsNullOrEmpty(Me.txtMailKeyVerify.Text.Trim) Then blnOK = False strMessage &= "Password Cannot be blank" & vbCrLf End If End If
If txtMailKey.Text <> txtMailKeyVerify.Text Then blnOK = False strMessage &= "Password does not match" & vbCrLf End If 'Show the accumulated errors if any If blnOK = False Then strMessage = "The following error(s) must be resolved before proceeding" & vbCrLf & vbCrLf & strMessage End If
'is True only if every check is passed Return blnOK
End Function
End Class
this is all i have done with it. cimalock is the dll file
End Sub Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click If Me.editCheck() = True Then
Dim MyEncryption As New CIMABank.MyEncryption Me._data.UpdateFromTable(Me._mailSetup) Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close()
End If End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub
Private Function editCheck() As Boolean 'check for completeness 'called after OK button is hit Dim blnOK As Boolean = True Dim strMessage As String = ""
If String.IsNullOrEmpty(Me.txtMailKey.Text.Trim) Then blnOK = False strMessage &= "Password Cannot be blank" & vbCrLf Else If String.IsNullOrEmpty(Me.txtMailKeyVerify.Text.Trim) Then blnOK = False strMessage &= "Password Cannot be blank" & vbCrLf End If End If
If txtMailKey.Text <> txtMailKeyVerify.Text Then blnOK = False strMessage &= "Password does not match" & vbCrLf End If 'Show the accumulated errors if any If blnOK = False Then strMessage = "The following error(s) must be resolved before proceeding" & vbCrLf & vbCrLf & strMessage End If
'is True only if every check is passed Return blnOK
End Function
End Class
this is all i have done with it. cimalock is the dll file
The only line of code I see related to cimalock is 'Dim MyEncryption As New CIMABank.MyEncryption'? Is that were the error is being thrown?
My guess is that your cimalock.dll is throwing an unhandled error during its initialization and VS can't find the source code to show you the error. This is one of the reason i suggested earlier about including cimalock project into your solution, remove the direct reference to cimalock.dll and add a project reference to the cimalock project. Now when the error is thrown in your cimalock classes VS will break into the cimalock project at the error.
ok i think i will do it that way. but if i do it and they ask me to do it the other way would you have an idea on how to do that
There is technically no difference between the two methods from a deployment standpoint. VS will still compile the CIMALock project into its own dll. It just simplifies your development process.