Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loosing French characters
Message
De
24/06/2007 23:14:43
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Cryptographie
Titre:
Loosing French characters
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01235283
Message ID:
01235283
Vues:
51
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform