Public Shared Function Decrypt(ByVal tcString As String, ByVal sDecrKey As String) As Boolean Dim llSuccess As Boolean Dim des As New TripleDESCryptoServiceProvider Dim hashmd5 As New MD5CryptoServiceProvider llSuccess = False cDecrypt = "" Try des.Key = hashmd5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(sDecrKey)) des.Mode = CipherMode.ECB Dim desdencrypt As ICryptoTransform = des.CreateDecryptor() Dim buff() As Byte = Convert.FromBase64String(tcString) cDecrypt = ASCIIEncoding.ASCII.GetString(desdencrypt.TransformFinalBlock(buff, 0, buff.Length)) 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