0
我看了其他答案,但我仍然感到困惑。VB.NET要解密的数据长度无效
我正在测试我在ASP.NET项目中复制的加密代码。我不知道为什么它在vb.net中有错误。帮帮我!
在此先感谢
Dim EncryptionKey As String = "SamplePassword"
Dim pdb As New Rfc2898DeriveBytes(EncryptionKey, New Byte() { 8 bytes here}, 10000)
Using fileCrypt As New FileStream(Application.StartupPath + "\output.txt", FileMode.Create)
Using encrypt As New AesManaged()
Using cs As New CryptoStream(fileCrypt, encrypt.CreateDecryptor(pdb.GetBytes(32), pdb.GetBytes(16)), CryptoStreamMode.Write)
Using fileInput As New FileStream(Application.StartupPath + "\input.txt", FileMode.Open)
encrypt.KeySize = 256
encrypt.BlockSize = 128
Dim data As Integer
While (InlineAssignHelper(data, fileInput.ReadByte())) <> -1
cs.WriteByte(CByte(data))
End While
End Using
End Using
End Using
End Using
似乎无法使用你的答案。我正在使用其他流进行加密 –
已更改答案。不知道这是否适合你。 – Sameer
伤心它不起作用:( –