Click here to Skip to main content
15,941,071 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,
I use Rijndael Manged algo in c# for decrypt messages that I received from my clients.
I have a key and in addition I have IV of 16 bytes that change in every message (In every message it will place in constant offset).
According to the sample I see my code is ,

C#
RijndaelManaged _aes;
ICryptoTransform _decryptor;
public void Decrypt(byte [] newIv,byte [] message,ref byte [] output)
{
    _aes.IV = newIv;
    _decryptor=_aes.CreateDecryptor();
    _decryptor.TransformBlock(message, 0, message.Length, output, 0);
}


For each new IV I need to create a new Decryptor by aesAlg.CreateDecryptor,
It's seem to my an expensive action (create new decryptor for every message) only because I change the IV key ( I received messages from clients in total rate of 1000 HZ, each client have different IV but the same key)
May I make something wrong ? , Or may you know better implementation for that?
May you know what C# make behind the aesAlg.CreateDecryptor command and how much it's actually do there (time and performance)?

Thanks,
M.A.K
Posted
Updated 20-Feb-15 6:11am
v2
Comments
Richard MacCutchan 20-Feb-15 9:35am    
Have you hardcoded the IV into the application?
[no name] 20-Feb-15 9:47am    
No, The client is generate the IV in every new message.
Richard MacCutchan 20-Feb-15 9:59am    
The only way to measure performance is to run it with some timing code. And if this value is different for every message, then you do not have much option as to how you have to process it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900