I'm having trouble encrypting a message in Java Spring (Spring Boot) using trusted self-signed certificate. I have built an app which sends a message to a target service. I've been provided with a certificate for Message Level Security which I added to the keystore. The app reads the keystore and tries to encrypt the message using the certificate but I'm getting an error during sending of the request saying "Servlet.service() for servlet [dispatcherServlet] in context with path  threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: not an RSA key!] with root cause java.lang.IllegalArgumentException: not an RSA key!"