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 (after a lot of stuffing
around), however one of the fields is encrypted and I need to decrypt it.
I have the key that was used to encrypt it but cant 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
---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/