' The function used to decrypt the text Public Shared Function Decrypt(ByVal tcString As String, ByVal sDecrKey As String) As Boolean Dim llSuccess As Boolean Dim byKey() As Byte = {} Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF} Dim inputByteArray(tcString.Length) As Byte llSuccess = False cDecrypt = "" Try byKey = System.Text.Encoding.UTF8.GetBytes(Mid(sDecrKey, 1, 8)) Dim des As New DESCryptoServiceProvider inputByteArray = Convert.FromBase64String(tcString) 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 cDecrypt = encoding.GetString(ms.ToArray()) llSuccess = True Catch loError As Exception App.ErrorSetup(loError) If App.cError.StartsWith("Bad Data") Then App.cError = "You didn't encrypt the XML string with a valid key." End If If App.cError.StartsWith("Invalid character in a Base-64 string") Then App.cError = "Unable to decrypt that data." End If End Try Return llSuccess End Function