Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This should be sufficient. I use this when testing code against testing and staging servers where we don't have properly signed certificates. <strong><em>However, you should really really strongly consider getting a valid SSL certificate on your production server</em></strong>. Nobody wants to be wiretapped and have their privacy violated.</p> <pre><code>SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, new TrustManager[] { new TrustAllX509TrustManager() }, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier(){ public boolean verify(String string,SSLSession ssls) { return true; } }); </code></pre> <p>And this.</p> <pre><code>import javax.net.ssl.X509TrustManager; import java.security.cert.X509Certificate; /** * DO NOT USE IN PRODUCTION!!!! * * This class will simply trust everything that comes along. * * @author frank * */ public class TrustAllX509TrustManager implements X509TrustManager { public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) { } } </code></pre> <p>Best of luck!</p> <p><strong>===UPDATE===</strong></p> <p>I just wanted to point out that there's a service called <a href="https://letsencrypt.org" rel="nofollow noreferrer">Let's Encrypt</a> which automates the process of generating and setting up SSL/TLS certificates recognised by virtually everybody, and it's absolutely free!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload