public boolean isValid(){
  try {
    myCertificate.checkValidity();
    return true;
  }
 catch (  Exception e) {
    return false;
  }
}

public boolean isValid ( ) { try { myCertificate . checkValidity ( ) ; return true ; } catch ( Exception e ) { return false ; } }
check whether certificate is valid . it ' s considered invalid it it either expired or not yet valid .
