error when trying to decrypt email address in vb

asmall24

New Member
I am trying to decrypt email address in VB.NET but I am getting an error: "Invalid length for a Base-64 char array."email address which gives error: [email protected] address which works ok: [email protected] for decrypting:\[code\] Private Function Decrypt(ByVal strText As String, ByVal sDecrKey _ As String) As String 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("ABCD9876_", 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 End Try End Function\[/code\]Thanks in advance, Laziale
 
Back
Top