AES解密错误

时间:2013-08-20 02:25:32

标签: vb.net

您好我收到此错误:字符之间的填充无效且无法删除或填充无效且无法删除。

代码是:

Public Shared Function Decrypt(ByVal Text As String) As String
    Dim inputBytes As Byte() = Convert.FromBase64String(Text)
    Dim resultBytes As Byte() = New Byte(inputBytes.Length + 1) {}
    Dim DecryptedText As String = [String].Empty
    Dim Cripto As New RijndaelManaged()

    Using ms As New MemoryStream(inputBytes)
        Using objCryptoStream As New CryptoStream(ms, Cripto.CreateDecryptor(_key, _iv), CryptoStreamMode.Read)
            Using sr As New StreamReader(objCryptoStream, True)
                DecryptedText= sr.ReadToEnd()
            End Using
        End Using
    End Using

    Return DecryptedText
End Function

请帮帮我

0 个答案:

没有答案