AES decryption error “ The input data is not a complete block.” Error vb.net

前端 未结 3 671
你的背包
你的背包 2021-01-26 04:35

I keep getting this \"The input data is not a complete block.\" error while decrypting. The function successfully encrypts plain text and puts the IV in a textbox. I am using t

3条回答
  •  误落风尘
    2021-01-26 05:22

    I had the same problem until I implemented with ICryptoTransform:

    ...
    Dim AES As New AesCryptoServiceProvider
    AES.Key = Encryptionkey
    AES.Mode = CipherMode.CBC
    AES.IV = Convert.FromBase64String(tbIV.Text)
    
    Dim transformer As ICryptoTransform = AES.CreateDecryptor()
    dim trnsfrmBlock as Byte() = transformer.TransformFinalBlock(EncryptionIn, 0, EncryptionIn.Length)
    
    Return Convert.ToBase64String(trnsfrmBlock)
    

提交回复
热议问题