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.