Self-signed SSL acceptance on Android

I have this functionality in exchangeIt, which connects to Microsoft exchange via WebDav. Here’s some code to create an HttpClient which will connect to self signed cert’s via SSL: SchemeRegistry schemeRegistry = new SchemeRegistry(); // http scheme schemeRegistry.register(new Scheme(“http”, PlainSocketFactory.getSocketFactory(), 80)); // https scheme schemeRegistry.register(new Scheme(“https”, new EasySSLSocketFactory(), 443)); HttpParams params = new BasicHttpParams(); params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, … Read more

How to properly import a selfsigned certificate into Java keystore that is available to all Java applications by default?

On Windows the easiest way is to use the program portecle. Download and install portecle. First make 100% sure you know which JRE or JDK is being used to run your program. On a 64 bit Windows 7 there could be quite a few JREs. Process Explorer can help you with this or you can … Read more

This certificate has an invalid issuer Apple Push Services

I think I’ve figured this one out. I imported the new WWDR Certificate that expires in 2023, but I was still getting problems building and my developer certificates were still showing the invalid issuer error. In keychain access, go to View -> Show Expired Certificates. Then in your login keychain highlight the expired WWDR Certificate … Read more

Using openssl to get the certificate from a server

With SNI If the remote server is using SNI (that is, sharing multiple SSL hosts on a single IP address) you will need to send the correct hostname in order to get the right certificate. openssl s_client -showcerts -servername www.example.com -connect www.example.com:443 </dev/null Without SNI If the remote server is not using SNI, then you … Read more

curl: (60) SSL certificate problem: unable to get local issuer certificate

Relating to ‘SSL certificate problem: unable to get local issuer certificate’ error. It is important to note that this applies to the system sending the CURL request, and NOT the server receiving the request. Download the latest cacert.pem from https://curl.se/ca/cacert.pem Add the ‘–cacert /path/to/cacert.pem’ option to the curl command to tell curl where the local … Read more

Trust Anchor not found for Android SSL Connection

Contrary to the accepted answer you do not need a custom trust manager, you need to fix your server configuration! I hit the same problem while connecting to an Apache server with an incorrectly installed dynadot/alphassl certificate. I’m connecting using HttpsUrlConnection (Java/Android), which was throwing – javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. … Read more

Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

The problem appears when your server has self signed certificate. To workaround it you can add this certificate to the list of trusted certificates of your JVM. In this article author describes how to fetch the certificate from your browser and add it to cacerts file of your JVM. You can either edit JAVA_HOME/jre/lib/security/cacerts file … Read more