How to generate and verify signature using RSA algorithm in NS2

Description

A node that the RREQ verifies that the sender is authenticated user or not by verifying the signature generated using asymmetric cryptography algorithm RSA and it forwards the RREQ to destination only if it is received from authenticated user otherwise it will not forward the RREQ.

set source 22
set destination 24
set udp [new Agent/UDP]
$ns attach-agent $n_($source) $udp
set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 512
$cbr set interval_ 0.1
$cbr attach-agent $udp
set lm($destination) [new Agent/LossMonitor]
$ns attach-agent $n_($destination) $lm($destination)
$ns connect $udp $lm($destination)
$ns at [expr $now + 2.0] "$cbr start"
$ns at [expr $now + 5.0] "$cbr stop"