Obtain the same number of characters from an encrypted text

0

I have the following code which returns an encrypted text, but the result is always a much larger text than typed, is there any way to get the same size?

   Public Shared Function desencryptar(ByVal texto As String) As String
        Dim salt As Byte() = New Byte() {172, 137, 25, 56, 156, 100, 136, 211, 84, 67, 96, 10, 24, 111, 112, 137, 3}
        Dim iterations As Integer = 1024
        Dim password As String = "sOme*ShaREd*SecreT"
        Dim rfc2898 = New System.Security.Cryptography.Rfc2898DeriveBytes(password, salt, iterations)
        Dim key As Byte() = rfc2898.GetBytes(16)
        Dim keyB64 As String = Convert.ToBase64String(key)
        Dim aesCipher As AesManaged = New AesManaged()
        aesCipher.KeySize = 128
        aesCipher.BlockSize = 128
        aesCipher.Mode = CipherMode.CFB
        aesCipher.Padding = PaddingMode.PKCS7
        aesCipher.Key = key
        Dim cipherB64 As String = texto
        aesCipher.IV = System.Text.Encoding.UTF8.GetBytes("1234567890123456")
        Dim cipherText As Byte() = Convert.FromBase64String(cipherB64)
        Dim decryptTransform As ICryptoTransform = aesCipher.CreateDecryptor()
        Dim plainText As Byte() = decryptTransform.TransformFinalBlock(cipherText, 0, cipherText.Length)
        Return System.Text.Encoding.UTF8.GetString(plainText)
    End Function
    
asked by Albert Jiménez 09.08.2018 в 22:24
source

0 answers