List of usage examples for javax.security.cert X509Certificate getInstance
public static final X509Certificate getInstance(byte[] certData) throws CertificateException
From source file:pl.psnc.synat.wrdz.zu.certificate.CertificateChecker.java
/** * Checks whether any active users' certificates are beyond the expiration threshold. *//*from w w w . j a v a 2 s . c o m*/ @TransactionAttribute public void checkCertificates() { List<UserAuthentication> auths = userAuthDao.findAll(); Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, configuration.getCertificateCheckThreshold()); Date cutoff = cal.getTime(); for (UserAuthentication auth : auths) { if (auth.getActive() && auth.getCertificate() != null) { try { X509Certificate certificate = X509Certificate .getInstance(Base64.decodeBase64(auth.getCertificate())); if (cutoff.after(certificate.getNotAfter())) { notifyExpirationCheckFail(auth.getUser().getUsername()); } } catch (CertificateException e) { logger.warn("Certificate could not be read", e); } } } }