List of usage examples for java.security.cert CertificateExpiredException printStackTrace
public void printStackTrace()
From source file:ch.swisscom.mid.verifier.MobileIdCmsVerifier.java
/** * Checks that the certificate is currently valid. It is if the current date and time are within the validity period given in the certificate. * /*from w w w . j a v a 2 s . co m*/ * @return true if certificate is currently valid, false otherwise. */ private boolean isCertCurrentlyValid() { try { signerCert.checkValidity(); return true; } catch (CertificateExpiredException e) { e.printStackTrace(); } catch (CertificateNotYetValidException e) { e.printStackTrace(); } return false; }
From source file:org.fedoraproject.eclipse.packager.FedoraSSL.java
/** * Determine if FAS certificate (~/.fedora.cert) is valid. * /*from w w w .j a v a2 s . c o m*/ * @return {@code true} if certificate exist and is valid. {@code false} * otherwise. */ public boolean isFedoraCertValid() { if (fedoraCert.exists()) { KeyMaterial kmat; try { kmat = new KeyMaterial(fedoraCert, fedoraCert, new char[0]); List<?> chains = kmat.getAssociatedCertificateChains(); Iterator<?> it = chains.iterator(); while (it.hasNext()) { X509Certificate[] certs = (X509Certificate[]) it.next(); if (certs != null) { if (certs.length == 1) { try { certs[0].checkValidity(); return true; } catch (CertificateExpiredException e) { return false; } catch (CertificateNotYetValidException e) { return false; } } } } } catch (GeneralSecurityException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } return false; }