Cryptography in wireless medium 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?
Firstly:

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).

Secondly: 

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.