code: public static String verifyCertificate(X509Certificate cert, Collection crls, Calendar calendar) {
          if (calendar == null)
              calendar = new GregorianCalendar();
          if (cert.hasUnsupportedCriticalExtension())
              return "Has unsupported critical extension";
          try {
              cert.checkValidity(calendar.getTime());
          }
          catch (Exception e) {
              return e.getMessage();
          }
          if (crls != null) {
              for (Iterator it = crls.iterator(); it.hasNext();) {
                  if (((CRL)it.next()).isRevoked(cert))
                      return "Certificate revoked";
              }
          }
          return null;
      }
docs: Verifies a single certificate.
  @param cert the certificate to verify
  @param crls the certificate revocation list or <CODE>null</CODE>
  @param calendar the date or <CODE>null</CODE> for the current date
  @return a <CODE>String</CODE> with the error description or <CODE>null</CODE>
  if no error