@Test public void certificatePresent() throws Exception{ SimpleReport simpleReport = validationService.validateDocument(buildValidationDocument("timestamptoken-ddoc.asics")).getSimpleReport(); TimeStampTokenValidationData timeStampTokenValidationData = simpleReport.getValidationConclusion().getTimeStampTokens().get(0); CertificateFactory cf = CertificateFactory.getInstance("X.509"); Assert.assertEquals(1, timeStampTokenValidationData.getCertificates().size()); ee.openeid.siva.validation.document.report.Certificate certificate = timeStampTokenValidationData.getCertificates().get(0); Assert.assertEquals(CertificateType.CONTENT_TIMESTAMP, certificate.getType()); Assert.assertEquals("SK TIMESTAMPING AUTHORITY", certificate.getCommonName()); Certificate timeStampCertificate = cf.generateCertificate(new ByteArrayInputStream(Base64.decode(certificate.getContent().getBytes()))); Assert.assertEquals("SK TIMESTAMPING AUTHORITY", CertUtil.getCommonName((X509Certificate) timeStampCertificate)); }
@Override public Reports validateDocument(ValidationDocument validationDocument) { List<InMemoryDocument> documents = getFilesFromContainer(validationDocument); validateContainer(documents); TimeStampToken timeStampToken = getTimeStamp(documents); List<Error> errors = validateTimeStamp(documents, timeStampToken); TimeStampTokenValidationReportBuilder reportBuilder = new TimeStampTokenValidationReportBuilder(validationDocument, timeStampToken, signaturePolicyService.getPolicy(validationDocument.getSignaturePolicy()), errors, reportConfigurationProperties.isReportSignatureEnabled()); return reportBuilder.build(); }
TimeStampTokenValidationService implements ValidationService { @Override public Reports validateDocument(ValidationDocument validationDocument) { List<InMemoryDocument> documents = getFilesFromContainer(validationDocument); validateContainer(documents); TimeStampToken timeStampToken = getTimeStamp(documents); List<Error> errors = validateTimeStamp(documents, timeStampToken); TimeStampTokenValidationReportBuilder reportBuilder = new TimeStampTokenValidationReportBuilder(validationDocument, timeStampToken, signaturePolicyService.getPolicy(validationDocument.getSignaturePolicy()), errors, reportConfigurationProperties.isReportSignatureEnabled()); return reportBuilder.build(); } }
TimeStampTokenValidationService implements ValidationService { @Override public Reports validateDocument(ValidationDocument validationDocument) { List<InMemoryDocument> documents = getFilesFromContainer(validationDocument); validateContainer(documents); TimeStampToken timeStampToken = getTimeStamp(documents); List<Error> errors = validateTimeStamp(documents, timeStampToken); TimeStampTokenValidationReportBuilder reportBuilder = new TimeStampTokenValidationReportBuilder(validationDocument, timeStampToken, signaturePolicyService.getPolicy(validationDocument.getSignaturePolicy()), errors, reportConfigurationProperties.isReportSignatureEnabled()); return reportBuilder.build(); }  }
TimeStampTokenValidationService implements ValidationService { @Override public Reports validateDocument(ValidationDocument validationDocument) { List<InMemoryDocument> documents = getFilesFromContainer(validationDocument); validateContainer(documents); TimeStampToken timeStampToken = getTimeStamp(documents); List<Error> errors = validateTimeStamp(documents, timeStampToken); TimeStampTokenValidationReportBuilder reportBuilder = new TimeStampTokenValidationReportBuilder(validationDocument, timeStampToken, signaturePolicyService.getPolicy(validationDocument.getSignaturePolicy()), errors, reportConfigurationProperties.isReportSignatureEnabled()); return reportBuilder.build(); }  @Override Reports validateDocument(ValidationDocument validationDocument); @Autowired @Qualifier("timestampPolicyService") void setSignaturePolicyService(SignaturePolicyService<ValidationPolicy> signaturePolicyService); @Autowired void setReportConfigurationProperties(ReportConfigurationProperties reportConfigurationProperties); }
TimeStampTokenValidationService implements ValidationService { @Override public Reports validateDocument(ValidationDocument validationDocument) { List<InMemoryDocument> documents = getFilesFromContainer(validationDocument); validateContainer(documents); TimeStampToken timeStampToken = getTimeStamp(documents); List<Error> errors = validateTimeStamp(documents, timeStampToken); TimeStampTokenValidationReportBuilder reportBuilder = new TimeStampTokenValidationReportBuilder(validationDocument, timeStampToken, signaturePolicyService.getPolicy(validationDocument.getSignaturePolicy()), errors, reportConfigurationProperties.isReportSignatureEnabled()); return reportBuilder.build(); }  @Override Reports validateDocument(ValidationDocument validationDocument); @Autowired @Qualifier("timestampPolicyService") void setSignaturePolicyService(SignaturePolicyService<ValidationPolicy> signaturePolicyService); @Autowired void setReportConfigurationProperties(ReportConfigurationProperties reportConfigurationProperties);  }