Overview
In this tutorial, we will create a SSL communication project in Android. The reason why we need SSL is that nowadays, many tools like tcpdump and wireshark can be taken avenue by attackers to intercept packets in the network. If the traditional socket programming is used, the data being transmitted is just plain text without any decryption, which will be a disaster if user’s personal information is hacked. Therefore, SSL provides a mechanism to encrypt and decrypt data being transmitted to protect data.
Objective
In Android, the traditional socket programming is just the same as what we do in network: a server is running forever to listen to the connection from clients and a client will initialize a connection with server. To achieve Secure Socket programming, the first step is to generate keys and certificates for server and client. Then the following steps are same as traditional socket programming. In this project, we will learn how to make a secure socket communication in Android.
SSL Communication Diagram
Introduction
SSL public/private key and Certificates are needed to test SSL socket communication in this project.
The procedure can be depict as the following picture.