@TamakiH8 private and public keys come in pairs. In your Keystore rule you would typically store this set of keys. Meaning you would not generate a public key based on a private key, but instead you could simply return the existing pulic key that belongs to that private key.
What you are describing sounds like some manual configuration of message level encryption attempt. You could publish your public key and ask others to use that to encrypt message that they sent to you. You could then decrypt it with the associate private key.
I suggest to discuss your approach with a Pega consultant specialised in security. Also you've marked your post with Pega Platform 8.2.2, so if your client feels strongly about security, I can also recommend an update.