title: Trusting an expired self-signed certificate while calling a webservice
body: <p>There is a webservice protected by a certificate. In the client code which calls it, the certificate's CA has to present in the truststore (JRE_path\lib\security\cacerts) - if not, you get the PKIX exception on the client side.  </p>
  
  <p>What happens if the certificate has expired - the the client code fails.  </p>
  
  <p>However, this can be bypassed by adding the certificate directly into the truststore - <a href="https://stackoverflow.com/questions/16072184/trusting-an-expired-certificate">Trusting an expired certificate</a></p>
  
  <p>i.e. if the certificate itself and not the CA is present in the truststore, then everything works even if the certificate has expired.  </p>
  
  <p>In my scenario, the webservice certificate is a self-signed one, so I anyway had to add it to the truststore, and the client continues to work fine even when the cert has expired.</p>
  
  <p>Now my question is will this work in all scenarios - my program is just a command line program running of a local JRE.  </p>
  
  <p>In case there is an application calling the webservice and the application is running on Websphere, JBoss, WebLogic, Tomcat, Glassfish etc and the self signed cert is added to truststore of that environment, can I still assume that it will continue to work (not give expired errors)?</p>
  
  <p>I assume it would work - because those application servers would also use a JRE just like any program - or am I missing something?</p>