I am not aware of any built-in methods, but you can use for example bcrypt to do that. As for key storing, you can use a keystore e.g. Java KeyStore just be sure it wont be publicly accessible
Thanks @Panos for your reply. I am just looking for out of the box solution for this as it will be tedious process to maintain keys ourself. In my requirement, I have to encrypt the value in Javascript using public key and decrypt the same in Java using Private key, storing them in Java keystore might not be suitable here.