2

I am trying to setup secure socket communication to a server. I have successfully tried the Socket class, but that is not a secure way of communication. From what I gather, SSLSocketFactory and SSLSocket is required for securing communication via sockets. How do i go about implementing these?

I used this code

SSLSocketFactory s = new SSLSocketFactory();
socket = s.createSocket(url, port);

but eclipse says i cannot instantiate SSLSocketFactory.

Amit
  • 3,952
  • 7
  • 46
  • 80

1 Answers1

4

You need to call SSLSocketFactory.getDefault() to get an SSLSocketFactory instance.

Also, maybe this will be of use to you: Using client/server certificates for two way authentication SSL socket on Android

Community
  • 1
  • 1
stork
  • 420
  • 1
  • 3
  • 12