Text Encryption Problems VB.NET


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Text Encryption Problems VB.NET

  1. #1
    Join Date
    Jul 2005
    Location
    NorCal, USA
    Posts
    64

    Question Text Encryption Problems VB.NET

    How's It Going!

    I recently decided that I am going to dive into using some text encryption on one of my app's config files for security. I found this article on "How To: Encrypt Data With Salt" & decided to try it out.

    Everything works great when reading the "Hello World" string & sending the strings to the console, but as soon as I add in properties to modify the plainText or cipherText strings, I get an error.

    Here's the code i am using...

    Code:
    Dim strCrypt As String
    
        Public Property PlainString() As String
            Get
                Return strCrypt
            End Get
            Set(ByVal Value As String)
                strCrypt = Value
            End Set
        End Property
    
        Dim strDeCrypt As String
    
        Public Property EncryptedString() As String
            Get
                Return strDeCrypt
            End Get
            Set(ByVal Value As String)
                strDeCrypt = Value
            End Set
        End Property
    Then I Change...

    Code:
    Dim plainText As String = PlainString
    'And
    EncryptedString = rijndaelKey.Encrypt(plainText)
    In Sub Main of the Module.

    I actually renamed Sub Main due To conflict with another Shared Sub Main I have.

    And call it like so to my config file...

    Code:
     With File.CreateText(strConfig)
                    .WriteLine("----- MyTools CONFIG ------")
                    .WriteLine("--------------------------")
                    .WriteLine(vbNullString)
                    PlainString = "User = " & strName
                    .WriteLine(EncryptedString)
                    TextEncrypt()
                    .Flush()
                    .Close()
                End With
    Any idea's anyone, or does anyone know of a better encryption of using?

    Thanks ahead of time!

    Jugg
    Last edited by Jugg; 04-01-2006 at 06:46 AM. Reason: typo...
    Where 1\2 My life is spent ..... FreeVBCode.Com

  2. #2
    Join Date
    Jul 2005
    Location
    NorCal, USA
    Posts
    64

    Lightbulb Ok, I Got The Idea...

    Go figure I shoulda hit up FreeVBCode 1st...

    Found a less complex example on "Rijndael Encryption in VB.NET" to start with.

    I did however notice that with SALT it was a far more complex encryption to break.

    So it's off to look into that, or if someone has some pointers in that direction it would be appreciated.

    Jugg
    Where 1\2 My life is spent ..... FreeVBCode.Com

  3. #3
    Join Date
    Jul 2005
    Location
    NorCal, USA
    Posts
    64

    Lightbulb Another Great Example...

    There's also a good encryption example in the "101 VB .NET Code Samples" found here on MSDN.

    There's a lot of other great stuff in the samples also.

    Jugg
    Where 1\2 My life is spent ..... FreeVBCode.Com

Similar Threads

  1. Find and highlight text
    By Urbaud in forum VB Classic
    Replies: 2
    Last Post: 03-13-2006, 02:12 PM
  2. Reading and writing lines from a text file...
    By Jenks in forum VB Classic
    Replies: 6
    Last Post: 05-24-2005, 02:22 PM
  3. Replies: 2
    Last Post: 09-29-2002, 09:58 AM
  4. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM
  5. A moderate view.
    By Paul Mc in forum .NET
    Replies: 214
    Last Post: 06-01-2001, 07:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center