Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Loosing French characters
Message
From
24/06/2007 23:14:43
 
 
To
All
General information
Forum:
ASP.NET
Category:
Cryptography
Title:
Loosing French characters
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01235283
Message ID:
01235283
Views:
52
I am using a standard .NET code to encrypt some strings. This is widely used across the net. The code supports DES, RC2, Rinjdael and TripleDes. The entry code to encrypt is as follow, with minor modifications to fit our personal needs:
        Public Function Encrypt(ByVal data As String, ByVal userKey As String, _
         ByVal alg As EncryptionAlgorithm) As Boolean
            Dim cipherText As Byte()

            ' Create the encryptor object, specifying 3DES as the encryption algorithm
            Dim enc As New Encryptor(alg)

            ' Get the connection string as a byte array
            Dim plainText As Byte() = Encoding.ASCII.GetBytes(data)
            Dim key As Byte() = Encoding.ASCII.GetBytes(userKey)

            ' Perform the encryption
            If Not enc.Encrypt(plainText, key) Then

                ' Get the proper definition as per the current scope
                If oProcess Is Nothing Then
                    oApp.ErrorSetupControlledByTheFramework("Unable to encrypt. " + _
                     "The message is: " + enc.cError)
                Else
                    oProcess.ErrorSetupControlledByTheFramework("Unable to encrypt. " + _
                     "The message is: " + enc.cError)
                End If

                Return False
            End If

            cipherText = enc.oMemoryStreamEncryptedData

            ' Store the intialization vector, as this will be required for decryption
            Dim initVector As [String] = Convert.ToBase64String(enc.IV)

            cEncrypt = initVector + " " + Convert.ToBase64String(cipherText)
            Return True
        End Function
The problem I have is I just discovered that if I want to encrypt a string containing a French character that I will loose that on the decryption. Anyone would know what I would have to do, if anything could be done, to support those characters at the encryption and decryption level?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform