Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use HTTPS for webservice and android app?

Im working on some JSON-based web service that is supposed to work with Android application.

I would like to encrypt data transport between client (android) and server (virtual server in datacenter).

I don't have to make sure that my server is my server, just data encryption.

I have no idea how to use HTTPS.

Do I just put my PHP files in private_html and use https://example.com url?

like image 748
Kamil Avatar asked Feb 12 '26 15:02

Kamil


1 Answers

To use HTTPS, you don't have to do anything in the coding of your web service - it's all in your hosting. Here the are steps you can follow. The specific instructions differ in your hosting (IIS, Apache, AWS/Azure, etc), but you can google specifics on how to accomplish any of these steps for whatever host and application framework you decide.

  1. Buy an SSL certificate (there are many different vendors, but expect between $75-$200 for the certificate) based on the vendor, reputation, and level of security you need.

  2. Generate a certificate signing request (CSR) from the server you'll be hosting.

  3. Upload the CSR to the SSL vendor who will validate and provide the certificate for your use.

  4. Import the SSL certificate into your application server, and configure the site to use the certificate. For instance, if you're hosting Microsoft IIS, you'd import the SSL certificate and then add HTTPS bindings on 443 to the specific website hosting your web service.

Another point of security. Since you are deploying SSL, you don't have to do any application level encryption (assuming you are not putting sensitive information in query strings - use POST if you think you need to). You probably would want to implement some security to restrict access to your web service so only your app can access it. Best practice is some level of OAuth, but at a minimum some type of pre-shared key in the header of the request is a lot better than nothing.

Here are some additional sites for more information:

  • https://www.digicert.com/ssl-certificate-installation.htm
  • https://support.godaddy.com/help/category/742/ssl-certificates-installing-ssl-certificates?prog_id=GoDaddy
like image 191
Jason W Avatar answered Feb 15 '26 12:02

Jason W