/** * Create an instance of {@link XmlChainItem } * */ public XmlChainItem createXmlChainItem() { return new XmlChainItem(); }
/** * This method returns a list of certificate ids * * @return the list of certificate ids */ public List<String> getCertificateIds() { List<String> ids = new ArrayList<String>(); List<XmlChainItem> chain = simpleReport.getChain(); for (XmlChainItem xmlChainItem : chain) { ids.add(xmlChainItem.getId()); } return ids; }
/** * This method returns the qualification of the first certificate at its issuance * * @return the qualification at the certificate creation */ public CertificateQualification getQualificationAtCertificateIssuance() { XmlChainItem cert = getFirstCertificate(); return cert.getQualificationAtIssuance(); }
private XmlChainItem getChainItem(CertificateWrapper certificate) { XmlChainItem item = new XmlChainItem(); item.setId(certificate.getId()); item.setSubject(getSubject(certificate)); String signingCertificateId = certificate.getSigningCertificateId(); if (Utils.isStringNotBlank(signingCertificateId)) { item.setIssuerId(signingCertificateId); item.setNotBefore(certificate.getNotBefore()); item.setNotAfter(certificate.getNotAfter()); item.setKeyUsages(certificate.getKeyUsages()); item.setExtendedKeyUsages(getReadable(certificate.getExtendedKeyUsages())); item.setAiaUrls(emptyToNull(certificate.getAuthorityInformationAccessUrls())); item.setOcspUrls(emptyToNull(certificate.getOCSPAccessUrls())); item.setCrlUrls(emptyToNull(certificate.getCRLDistributionPoints())); item.setCpsUrls(emptyToNull(certificate.getCpsUrls())); item.setPdsUrls(null); revocation.setRevocationReason(revocationData.getReason()); item.setRevocation(revocation); item.setTrustAnchors(trustAnchors); } else { item.setTrustAnchors(null); item.setIndication(detailedReport.getCertificateXCVIndication(certificate.getId()));
assertEquals(certificateId, cert.getId()); assertNotNull(cert.getQualificationAtIssuance()); assertNotNull(cert.getQualificationAtValidation()); assertNull(cert.getTrustAnchors()); assertNull(ca.getQualificationAtIssuance()); assertNull(ca.getQualificationAtValidation()); assertNotNull(ca.getTrustAnchors());
/** * This method returns a Set of trust anchor VAT numbers * * @return a Set of VAT numbers */ public Set<String> getTrustAnchorVATNumbers() { Set<String> result = new HashSet<String>(); XmlChainItem cert = getTrustAnchorCertificate(); if (cert != null) { List<XmlTrustAnchor> trustAnchors = cert.getTrustAnchors(); for (XmlTrustAnchor xmlTrustAnchor : trustAnchors) { result.add(xmlTrustAnchor.getTrustServiceProviderRegistrationId()); } } return result; }
/** * This method returns the qualification of the first certificate at the validation time * * @return the qualification at the validation time */ public CertificateQualification getQualificationAtValidationTime() { XmlChainItem cert = getFirstCertificate(); return cert.getQualificationAtValidation(); }
/** * This method returns the list of CRL (Certificate Revocation List) urls for a given certificate * * @param certificateId * the certificate id * @return the list of CRL urls */ public List<String> getCertificateCrlUrls(String certificateId) { XmlChainItem cert = getCertificate(certificateId); if (cert != null) { return cert.getCrlUrls(); } return Collections.emptyList(); }
/** * This method returns the list of AIA urls (caIssuers) for a given certificate * * @param certificateId * the certificate id * @return the list of AIA urls */ public List<String> getCertificateAiaUrls(String certificateId) { XmlChainItem cert = getCertificate(certificateId); if (cert != null) { return cert.getAiaUrls(); } return Collections.emptyList(); }
/** * This method returns the notAfter date for a given certificate * * @param certificateId * the certificate id * @return the notAfter date */ public Date getCertificateNotAfter(String certificateId) { XmlChainItem cert = getCertificate(certificateId); if (cert != null) { return cert.getNotAfter(); } return null; }
/** * This method returns the list of CPS (Certificate Practice Statements) urls for a given certificate * * @param certificateId * the certificate id * @return the list of CPS urls */ public List<String> getCertificateCpsUrls(String certificateId) { XmlChainItem cert = getCertificate(certificateId); if (cert != null) { return cert.getCpsUrls(); } return Collections.emptyList(); }
/** * This method returns the indication (result of validation) for a given certificate * * @param certificateId * the certificate id * @return the indication */ public Indication getCertificateIndication(String certificateId) { XmlChainItem cert = getCertificate(certificateId); if (cert != null) { return cert.getIndication(); } return null; }
@Test public void dkNoChain() throws Exception { FileInputStream fis = new FileInputStream("src/test/resources/cert-validation/dk_no_chain.xml"); DiagnosticData diagnosticData = getJAXBObjectFromString(fis, DiagnosticData.class, "/xsd/DiagnosticData.xsd"); assertNotNull(diagnosticData); String certificateId = "3ECBC4648AA3BCB671976F53D7516F774DB1C886FAB81FE5469462181187DB8D"; CertificateProcessExecutor executor = new CertificateProcessExecutor(); executor.setCertificateId(certificateId); executor.setDiagnosticData(diagnosticData); executor.setValidationPolicy(loadPolicy()); executor.setCurrentTime(diagnosticData.getValidationDate()); CertificateReports reports = executor.execute(); DetailedReport detailedReportJaxb = reports.getDetailedReportJaxb(); assertNotNull(detailedReportJaxb); assertNotNull(detailedReportJaxb.getCertificate()); assertEquals(0, detailedReportJaxb.getTLAnalysis().size()); assertEquals(1, detailedReportJaxb.getBasicBuildingBlocks().size()); assertEquals(0, detailedReportJaxb.getSignatures().size()); SimpleCertificateReport simpleReportJaxb = reports.getSimpleReportJaxb(); assertNotNull(simpleReportJaxb); assertNotNull(simpleReportJaxb.getChain()); assertEquals(1, simpleReportJaxb.getChain().size()); XmlChainItem cert = simpleReportJaxb.getChain().get(0); assertEquals(certificateId, cert.getId()); assertNotNull(cert.getQualificationAtIssuance()); assertNotNull(cert.getQualificationAtValidation()); assertNull(cert.getTrustAnchors()); }
private XmlChainItem getTrustAnchorCertificate() { List<XmlChainItem> chain = simpleReport.getChain(); for (XmlChainItem xmlChainItem : chain) { if (Utils.isCollectionNotEmpty(xmlChainItem.getTrustAnchors())) { return xmlChainItem; } } return null; }
assertEquals(certificateId, cert.getId()); assertNotNull(cert.getQualificationAtIssuance()); assertNotNull(cert.getQualificationAtValidation()); assertNull(cert.getTrustAnchors()); assertNull(ca.getQualificationAtIssuance()); assertNull(ca.getQualificationAtValidation()); assertNotNull(ca.getTrustAnchors());
private XmlChainItem getCertificate(String certificateId) { List<XmlChainItem> chain = simpleReport.getChain(); for (XmlChainItem xmlChainItem : chain) { if (Utils.areStringsEqual(certificateId, xmlChainItem.getId())) { return xmlChainItem; } } return null; }