private void checkValidity(long time) throws CertificateExpiredException, CertificateNotYetValidException { if (time < getNotBeforeInternal()) { throw new CertificateNotYetValidException("current time: " + new Date(time) + ", validation time: " + new Date(getNotBeforeInternal())); } if (time > getNotAfterInternal()) { throw new CertificateExpiredException("current time: " + new Date(time) + ", expiration time: " + new Date(getNotAfterInternal())); } }
private static void validateCertificates(KeyStore keyStore) throws GeneralSecurityException { for (String alias : list(keyStore.aliases())) { if (!keyStore.isKeyEntry(alias)) { continue; } Certificate certificate = keyStore.getCertificate(alias); if (!(certificate instanceof X509Certificate)) { continue; } try { ((X509Certificate) certificate).checkValidity(); } catch (CertificateExpiredException e) { throw new CertificateExpiredException("KeyStore certificate is expired: " + e.getMessage()); } catch (CertificateNotYetValidException e) { throw new CertificateNotYetValidException("KeyStore certificate is not yet valid: " + e.getMessage()); } } }
private static void validateCertificates(KeyStore keyStore) throws GeneralSecurityException { for (String alias : list(keyStore.aliases())) { if (!keyStore.isKeyEntry(alias)) { continue; } Certificate certificate = keyStore.getCertificate(alias); if (!(certificate instanceof X509Certificate)) { continue; } try { ((X509Certificate) certificate).checkValidity(); } catch (CertificateExpiredException e) { throw new CertificateExpiredException("KeyStore certificate is expired: " + e.getMessage()); } catch (CertificateNotYetValidException e) { throw new CertificateNotYetValidException("KeyStore certificate is not yet valid: " + e.getMessage()); } } }
private void checkValidity(long time) throws CertificateExpiredException, CertificateNotYetValidException { if (time < getNotBeforeInternal()) { throw new CertificateNotYetValidException("current time: " + new Date(time) + ", validation time: " + new Date(getNotBeforeInternal())); } if (time > getNotAfterInternal()) { throw new CertificateExpiredException("current time: " + new Date(time) + ", expiration time: " + new Date(getNotAfterInternal())); } }
private void checkValidity(long time) throws CertificateExpiredException, CertificateNotYetValidException { if (time < getNotBeforeInternal()) { throw new CertificateNotYetValidException("current time: " + new Date(time) + ", validation time: " + new Date(getNotBeforeInternal())); } if (time > getNotAfterInternal()) { throw new CertificateExpiredException("current time: " + new Date(time) + ", expiration time: " + new Date(getNotAfterInternal())); } }
private void checkValidity(long time) throws CertificateExpiredException, CertificateNotYetValidException { if (time < getNotBeforeInternal()) { throw new CertificateNotYetValidException("current time: " + new Date(time) + ", validation time: " + new Date(getNotBeforeInternal())); } if (time > getNotAfterInternal()) { throw new CertificateExpiredException("current time: " + new Date(time) + ", expiration time: " + new Date(getNotAfterInternal())); } }
private void checkValidity(long time) throws CertificateExpiredException, CertificateNotYetValidException { if (time < getNotBeforeInternal()) { throw new CertificateNotYetValidException("current time: " + new Date(time) + ", validation time: " + new Date(getNotBeforeInternal())); } if (time > getNotAfterInternal()) { throw new CertificateExpiredException("current time: " + new Date(time) + ", expiration time: " + new Date(getNotAfterInternal())); } }
private void checkValidity(long time) throws CertificateExpiredException, CertificateNotYetValidException { if (time < getNotBeforeInternal()) { throw new CertificateNotYetValidException("current time: " + new Date(time) + ", validation time: " + new Date(getNotBeforeInternal())); } if (time > getNotAfterInternal()) { throw new CertificateExpiredException("current time: " + new Date(time) + ", expiration time: " + new Date(getNotAfterInternal())); } }
@Override public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (getNotBefore().compareTo(date) > 0) { throw new CertificateNotYetValidException(); } if (getNotAfter().compareTo(date) < 0) { throw new CertificateExpiredException(); } }
@Override public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (getNotBefore().compareTo(date) > 0) { throw new CertificateNotYetValidException("Certificate not valid until " + getNotBefore().toString() + " (compared to " + date.toString() + ")"); } if (getNotAfter().compareTo(date) < 0) { throw new CertificateExpiredException("Certificate expired at " + getNotAfter().toString() + " (compared to " + date.toString() + ")"); } }
@Override public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (getNotBefore().compareTo(date) > 0) { throw new CertificateNotYetValidException(); } if (getNotAfter().compareTo(date) < 0) { throw new CertificateExpiredException(); } }
@Override public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (getNotBefore().compareTo(date) > 0) { throw new CertificateNotYetValidException("Certificate not valid until " + getNotBefore().toString() + " (compared to " + date.toString() + ")"); } if (getNotAfter().compareTo(date) < 0) { throw new CertificateExpiredException("Certificate expired at " + getNotAfter().toString() + " (compared to " + date.toString() + ")"); } }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }