Good ideas and conversation. No ads, no tracking. Login or Take a Tour!
It goes without saying (or maybe it doesn't!) that you must use valid p and q values when calculating your RSA keys. You don't say here what HB_modexp() looks like. Did you simply rename it, perhaps? The reason I didn't name it so in the first place, is because mod_exp() is not a public function. As a 'static', it is meant to be local, and only called from the encrypt/decrypt functions.