How-to articles, tricks, and solutions about HTTPS

Accept server's self-signed ssl certificate in Java client

To accept a server's self-signed SSL certificate in a Java client, you can create a custom and use it to override the default trust manager.

Can't connect to HTTPS site using cURL. Returns 0 length content instead. What can I do?

There are several possible reasons why cURL is returning a 0 length response when trying to connect to an HTTPS site.

How to get file_get_contents() to work with HTTPS?

To get file_get_contents() to work with HTTPS, you may need to make sure that PHP has been compiled with the OpenSSL extension.

How to send HTTPS posts using php

To send an HTTPS POST request using PHP, you can use the curl extension.

Java HTTPS client certificate authentication

To perform HTTPS client certificate authentication in Java, you can use the HttpsURLConnection class and the SSLSocketFactory class.

Setting up SSL on a local xampp/apache server

To set up SSL on a local XAMPP/Apache server, you will need to generate a self-signed certificate, configure the Apache server to use the certificate, and then access the server using https.

Trusting all certificates using HttpClient over HTTPS

To trust all certificates when using the Apache HttpClient library to make HTTPS requests, you can create a custom X509TrustManager implementation that trusts all certificates and use it to create an SSLContext with a custom TrustStrategy.