code: public void valid(Date now)
      throws CertificateNotYetValidException, CertificateExpiredException {
          /*
           * we use the internal Dates rather than the passed in Date
           * because someone could override the Date methods after()
           * and before() to do something entirely different.
           */
          if (notBefore.after(now)) {
              throw new CertificateNotYetValidException("NotBefore: " +
                                                        notBefore.toString());
          }
          if (notAfter.before(now)) {
              throw new CertificateExpiredException("NotAfter: " +
                                                    notAfter.toString());
          }
      }
docs: Verify that that the passed time is within the validity period.
  
  @exception CertificateExpiredException if the certificate has expired
  with respect to the <code>Date</code> supplied.
  @exception CertificateNotYetValidException if the certificate is not
  yet valid with respect to the <code>Date</code> supplied.