How do I implement asymmetric key algorithm into wireless medium using NS 2.35?

For example: node $A$ is a sender and $B$ is a receiver. Now, $A$ is sending a packet using $B$s public key (encryption) and $B$ decrypts that packet using its private key .

My question is: how to produce the key into that wireless node and do the privacy stuff? Is it possible at all? If, are there any books or materials regarding this?

  • $\begingroup$ A few questions for you: What is ns 2.35? Why are you encrypting packets using asymmetric cryptography? Asymmetric crypto should not be used for bulk encryption. Why are you using the quantum-cryptography tag? That doesn't seem to make sense with the question. $\endgroup$ – mikeazo Jul 17 '15 at 14:03
  • $\begingroup$ sorry sir its my fault . . ns 2.35 is a simmulator which is used to simmulate different wired/wireless protocol . i just want to know that is it possible to perform cryptography for wireless nodes in ns 2 .. $\endgroup$ – Naman Vaishnav Jul 17 '15 at 14:13
  • 2
    $\begingroup$ How to do something (or whether or not it is possible to do) in NS2 is off-topic on this site. We could migrate the question to StackOverflow, which at least has an NS2 tag. What do you think? $\endgroup$ – mikeazo Jul 17 '15 at 16:17


RSA is computationally complex algorithm and should not be used to encrypt large data. RSA keys can be created with trusted third party. But is the system is in house then you can generate few keys through following technique shown here.

However, it is not recommended to use static set of keys for RSA (as there are security trade offs for reusing the keys).


You can use nested algorithms to get work done as shown below:

say $data = packet$;

$$E = AES_{ENC}(K, data) \\ K' = RSA_{ENC}(PubK, K)$$

and then share the encrypted key publicly.

You can use AES with some popular working modes like CBC-MAC, CTR, CCM etc. to achieve decent security with less computational complexity (now you can encrypt more data in less time)

And RSA will make sure the public key(of underlying AES) is secure.

On the other end:

$$K = RSA_{DEC}(PubK, K') \\ packet = AES_{DEC}(K, data)$$

Finally, Implementing it efficiently in NS2.35 is out of scope for this forum.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.