I plan to implement RSA encryption in Java with obtaining the public key from the server in php. What's the best way to do it?

I plan to implement RSA encryption in Java with obtaining the public key from the server in php. How best to pass the key, where to store the private key, and can the same key pair be generated each time?

Author: Serzh, 2020-09-29