title: Android Http to Https and SSL crt
body: <p>I am working on https post request.
  I did successfully http post request but i don't know how to change it with https SSL crt.
  How can I add SSL crt in project and how to convert http to https.
  I tried many examples but i didn't get it.</p>
  
  <p>My http post request code is.. saVersion is my lib</p>
  
  <pre><code> public class ServerCommunication implements Runnable, IServerCommunication {
   private static final String TAG = ServerCommunication.class.getSimpleName();
  
   private  String url;
   private  String userAgent;
   private  byte[] data;
  
   static
   {
          System.loadLibrary("saNative");
   }
  
  private static void receiveBytestream(byte[] stream)
  {
      saVersion.getInstance().onSecurePacketReceived(stream);
  }
  
  /**
   * Functions as a container to create other (meaningfuller) instances only
   */
  public ServerCommunication()
  {
      Log.d(TAG, "Note this class is deprecated");
  }
  
  
  private ServerCommunication(String _url, String _userAgent, byte[] _data)
  {
      url = _url;
      userAgent = _userAgent;
      data = _data;
  }
  
  public void run()
  {
      DefaultHttpClient httpclient = new DefaultHttpClient();
  
  
      if(url.equals(""))
      {
          Log.e(TAG, "URL is an empty string... aborting sending procedure");
          return;
      }
  
      // make URL     
      HttpPost httpost = new HttpPost(url);
  
      StringEntity se;
      try {
          se = new StringEntity(new String(data) + "\r\n");
  
  
          httpost.setEntity(se);
          httpost.setHeader("Accept", "application/json");
          httpost.setHeader("Content-Type", "application/json");
  
  
          // Get User Agent String
          httpost.setHeader("User-Agent", userAgent); // set string
  
      } catch (UnsupportedEncodingException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
  
      try {
  
          HttpResponse response = httpclient.execute(httpost);
  
  
          InputStreamReader sr = new InputStreamReader(response.getEntity().getContent());    
          byte[] respContent = IOUtils.toByteArray(sr);           
          receiveBytestream(respContent); 
      } 
      catch (ClientProtocolException e) 
      {
          Log.e(TAG, "AS-Connection error: Probably Internet-Permission is not set in your manifest?");
          e.printStackTrace();
  
      } 
      catch (IOException e) 
      {
          Log.e(TAG, "AS-Connection error: Probably Internet-Permission is not set in your manifest?");
          e.printStackTrace();
  
      }
      finally
      {
  
      }
  }    
  
  
  @Override
  public void sendSecurePacket(String _url, byte[] _data, String userAgent) {
      ServerCommunication sc = new ServerCommunication(_url, userAgent, _data);               
      Thread t = new Thread(sc);      
      t.start();  
  
  }
  </code></pre>
  
  <p>}</p>