I am receiving the following exception and do not know how to fix it.
java.security.InvalidKeyException: No installed provider supports this key: sun.
security.rsa.RSAPublicKeyImpl
I tried doing a
Security.addProvider(new sun.security.rsa.RSAPublicKeyImpl());
but received a '
cannot find symbol' error. Sorry, I'm new at this, so if a library needs to be included for this, someone tell me where it is cause I couldn't find information about it.
Here's some information I have.
The following providers were listed through Security.getProviders():
- SUN version 1.5
- SunRsaSign version 1.5
- SunJSSE version 1.5
- SunJCE version 1.5
- SunJGSS version 1.0
- SunSASL version 1.5
This is what I recieved from the HandshakeCompletedEvent.
CipherSuite:SSL_RSA_WITH_RC4_128_MD5
SessionId: [Session-1, SSL_RSA_WITH_RC4_128_MD5]
Certificate: 1 Sun RSA public key, 1024 bits
This is what I tried to do:
Cipher cipher = Cipher.getInstance("RC4");
cipher.init(Cipher.ENCRYPT_MODE, cert);
CipherOutputStream cos = new CipherOutputStream(socket.getOutputStream(), cipher);
cos.write("GET / HTTP/1.0\\r\\n\\r\\n".getBytes());
cos.flush();
socket is an SSLSocket.
cert is assigned through HandshakeCompletedEvent.getPeerCertificates()[0];
Did I do this wrongly?