private ServiceInfoStatus createUnderSupervisionStatus(String status, CertificateToken certToken, String type, Map<String, List<Condition>> qualifiersAndConditions) { Date startDate = getServiceInfoStartDate(); return new ServiceInfoStatus(type, status, qualifiersAndConditions, null, null, certToken.getCertificate().getNotBefore(), startDate, null); }
private List<String> getServiceSupplyPoints(CertificateToken trustAnchor, String... keywords) { List<String> urls = new ArrayList<String>(); Set<ServiceInfo> trustServices = getTrustServices(trustAnchor); for (ServiceInfo serviceInfo : trustServices) { for (ServiceInfoStatus serviceInfoStatus : serviceInfo.getStatus()) { List<String> serviceSupplyPoints = serviceInfoStatus.getServiceSupplyPoints(); if (Utils.isCollectionNotEmpty(serviceSupplyPoints)) { for (String serviceSupplyPoint : serviceSupplyPoints) { for (String keyword : keywords) { if (serviceSupplyPoint.contains(keyword)) { LOG.debug("ServiceSupplyPoints (TL) found for keyword '{}'", keyword); urls.add(serviceSupplyPoint); } } } } } } return urls; }
/** * Add a certificate to the TSL * <p/> * ServiceTypeIdentifier is http://uri.etsi.org/TrstSvc/Svctype/CA/QC <br/> * ServiceStatus is http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/undersupervision <br/> * Qualifier is http://uri.etsi.org/TrstSvc/TrustedList/SvcInfoExt/QCWithSSCD with nonRepudiation <br/> * * @param certificate X509 certificate to be added to the list */ @Override public void addTSLCertificate(X509Certificate certificate) { ServiceInfo serviceInfo = new ServiceInfo(); //TODO test addTSLCertificate Condition condition = new KeyUsageCondition(KeyUsageBit.nonRepudiation, true); Map<String, List<Condition>> qualifiersAndConditions = new HashMap<String, List<Condition>>(); qualifiersAndConditions.put("http://uri.etsi.org/TrstSvc/TrustedList/SvcInfoExt/QCWithSSCD", Arrays.asList(condition)); ServiceInfoStatus status = new ServiceInfoStatus("http://uri.etsi.org/TrstSvc/Svctype/CA/QC", "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/undersupervision", qualifiersAndConditions, null, null, null, certificate.getNotBefore(), null); TimeDependentValues timeDependentValues = new TimeDependentValues(Arrays.asList(status)); serviceInfo.setStatus(timeDependentValues); addCertificate(new CertificateToken(certificate), serviceInfo); }