1 Şubat 2011 Salı

Adding AES encryption and decryption to UDP Echo Application

I found a simple and compact solution for AES algorithm online. I was trying to develop a secure communication between mesh nodes and found cipher library.

You could find it here.

I put the source codes under the node folder of src folder. I also updated the wscript file and added the names of new source and header files. ./waf build system handles the rest. I made it so because in every application node module is used so I had no problem modifying example codes and I could use this cipher library in every example easily.

I choosed Udp Echo Application because it has built in SetFill function. Which is used for filling packet to send with data. This data is entered as a string parameter. The declaration of the function is given below.



void
UdpEchoClientHelper::SetFill (Ptr<Application> app, std::string fill);


I simply encrypted some string and put the ciphertext as a parameter to the function. For decryption we should look at Udp Echo Server application's HandleRead function, which works as some kind of an interrupt. When a node receives an Udp packet using Udp Echo Application, this function is fired. It is a siply callback.