Hi,

This has really been bugging me and I have decided to give up and ask
for help.

We have an application written in .NET that is used for user management.
After various problems (mostly from a lack of understanding in .NET) I
decided to rewrite the front end in CF.  The front end talks to a web
service that is written in .NET

The problem I am having is:

The web service returns all expected fields, however one of the fields
is encrypted and I need to decrypt it.  I have the key that was used to
encrypt it but can't figure out how to do it in CF.  The closest I have
gotten to getting it working is the following error:

There has been an error while trying to encrypt or decrypt your input
string: The input and output encodings are not same

I have the .NET code used to decrypt the field, but having trouble
working out what exactly it is doing.


    Private Shared Function Decrypt(ByVal strText As String, ByVal
sDecrKey _
               As String) As String
        If strText = "" Or strText = " " Then Exit Function
        Dim byKey() As Byte = {}
        Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD,
&HEF}
        Dim inputByteArray(strText.Length) As Byte
        Try
            byKey = System.Text.Encoding.UTF8.GetBytes(Left(sDecrKey,
8))
            Dim des As New DESCryptoServiceProvider
            inputByteArray = Convert.FromBase64String(strText)
            Dim ms As New MemoryStream
            Dim cs As New CryptoStream(ms, des.CreateDecryptor(byKey,
IV), CryptoStreamMode.Write)
            cs.Write(inputByteArray, 0, inputByteArray.Length)
            cs.FlushFinalBlock()
            Dim encoding As System.Text.Encoding =
System.Text.Encoding.UTF8
            Return encoding.GetString(ms.ToArray())
        Catch ex As Exception
            'Return ex.Message
            Return ""
        End Try

    End Function

Is anyone able to point me in the right direction?

Regards,
Mark Picker  


**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216457
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to