解密:要解密的数据长度无效

时间:2021-04-07 09:45:47

标签: vb.net encryption

尝试解密数据,但仅在使用转换为 75 位的长电子邮件时才会显示错误,任何其他使用的电子邮件都可以正常运行

(?: ^ | [^\w\d] ) \d+ (\s+) \d

当有一个 75 字节的字符串时,在 FLUSHFINAL 块发生错误:要解密的数据长度无效

Public Function DecryptData(
       ByVal encryptedtext As String) As String
       If String.IsNullOrEmpty(encryptedtext) Then
           Return ""
       End If

        Convert the encrypted text string to a byte array. 
       Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext)

       ' Create the stream. 
       Dim ms As New System.IO.MemoryStream
       ' Create the decoder to write to the stream. 
       Dim decStream As New CryptoStream(ms,
               TripleDes.CreateDecryptor(),
               System.Security.Cryptography.CryptoStreamMode.Write)

       ' Use the crypto stream to write the byte array to the stream.

       decStream.Write(encryptedBytes, 0, encryptedBytes.Length)

0 个答案:

没有答案
相关问题