- i++;
- return i != addrs.length - 1;
- }
- });
- final Certificate[] certs = user.getCertificates(true);
- final CertificateProfile[] profiles = CertificateProfile.getAll();
- vars.put("types", new IterableDataset() {
-
- int typeIndex = 0;
-
- @Override
- public boolean next(Language l, Map<String, Object> vars) {
- if (typeIndex > profiles.length - 1) {
- return false;
- }
- int valid = 0;
- int total = 0;
- long lastExpire = Long.MIN_VALUE;
- for (int i = 0; i < certs.length; i++) {
- try {
- if (certs[i].getProfile().getId() != profiles[typeIndex].getId()) {
- continue;
- }
- total++;
- certs[i].cert().checkValidity();
- lastExpire = Math.max(lastExpire, certs[i].cert().getNotAfter().getTime());
- valid++;
- } catch (GeneralSecurityException | IOException e) {
- continue;
- }
- }
- vars.put("total", total);
- vars.put("profile", profiles[typeIndex].getVisibleName());
- vars.put("valid", valid);
- vars.put("exp", total - valid);
- vars.put("rev", "TODO");
- if (lastExpire == Long.MIN_VALUE) {
- vars.put("lastdate", "-");
- } else {
- vars.put("lastdate", DateSelector.getDateFormat().format(new Date(lastExpire)));
- }
- typeIndex++;