I'm working on a project that I want to add SSL to, so I created a simple test client / server implementation to see if it works, and I get a NoSuchAlgorithmException. The following is the server code that throws the exception:
import java.io.*; import java.net.*; import java.security.KeyManagementException; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import javax.net.ssl.*; public class SslServer { private static final int PORT = 5555; public static void main(String[] args) { SecureRandom sr = new SecureRandom(); sr.nextInt(); try {
I get a stack:
java.security.NoSuchAlgorithmException: TLS KeyManagerFactory not available at sun.security.jca.GetInstance.getInstance(Unknown Source) at javax.net.ssl.KeyManagerFactory.getInstance(Unknown Source) at SslServer.main(SslServer.java:32)
I tried replacing βTLSβ with βSSLβ and I still have the same exception. It didn't make sense to me. How are TLS and SSL not supported? This is my first time trying to implement SSL, and it seems hard to find good resources about this with code examples that are well explained. Can someone tell me why I get this exception or point out something wrong with my code?
source share