Your idea was to encrypt using RSA public key and decrypt using the private key. If this is the case what you are doing correct. Just that you read the keys from key.pem.
Yes, that's what I want to do.
So I guess this is solved. Thank you very much for your help!