diff --git a/dss-asic-cades/pom.xml b/dss-asic-cades/pom.xml
index a3d5ae3bb5..4268f4dc4d 100644
--- a/dss-asic-cades/pom.xml
+++ b/dss-asic-cades/pom.xml
@@ -25,11 +25,5 @@
dss-test
test
-
- eu.europa.ec.joinup.sd-dss
- dss-document
- test-jar
- test
-
\ No newline at end of file
diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesParallelTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesParallelTest.java
index 45075de7fc..6ab692b9dc 100644
--- a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesParallelTest.java
+++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesParallelTest.java
@@ -17,7 +17,6 @@
import eu.europa.esig.dss.DSSUtils;
import eu.europa.esig.dss.InMemoryDocument;
import eu.europa.esig.dss.MimeType;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
@@ -26,17 +25,13 @@
import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters;
import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor;
import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.policy.rules.Indication;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
-public class ASiCECAdESLevelBMultiFilesParallelTest {
+public class ASiCECAdESLevelBMultiFilesParallelTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
@@ -44,39 +39,33 @@ public void test() throws Exception {
documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT));
documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT));
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier);
+ ASiCWithCAdESService service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithCAdESService(certificateVerifier);
+ service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
@@ -118,4 +107,9 @@ public void test() throws Exception {
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSignFourTimeTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSignFourTimeTest.java
index d9163add9d..b1d19ac73b 100644
--- a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSignFourTimeTest.java
+++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSignFourTimeTest.java
@@ -12,91 +12,76 @@
import eu.europa.esig.dss.ASiCContainerType;
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters;
import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.policy.rules.Indication;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
-public class ASiCECAdESLevelBSignFourTimeTest {
+public class ASiCECAdESLevelBSignFourTimeTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text");
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier);
+ ASiCWithCAdESService service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithCAdESService(certificateVerifier);
+ service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithCAdESService(certificateVerifier);
+ service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(resignedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
resignedDocument = service.signDocument(resignedDocument, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithCAdESService(certificateVerifier);
+ service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(resignedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
resignedDocument = service.signDocument(resignedDocument, signatureParameters, signatureValue);
resignedDocument.save("target/resigned.asice");
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
@@ -109,4 +94,9 @@ public void test() throws Exception {
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesParallelTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesParallelTest.java
index f8dd31fc2e..cca53dd1bb 100644
--- a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesParallelTest.java
+++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesParallelTest.java
@@ -17,7 +17,6 @@
import eu.europa.esig.dss.DSSUtils;
import eu.europa.esig.dss.InMemoryDocument;
import eu.europa.esig.dss.MimeType;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
@@ -26,17 +25,13 @@
import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters;
import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor;
import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.policy.rules.Indication;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
-public class ASiCSCAdESLevelBMultiFilesParallelTest {
+public class ASiCSCAdESLevelBMultiFilesParallelTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
@@ -44,39 +39,33 @@ public void test() throws Exception {
documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT));
documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT));
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier);
+ ASiCWithCAdESService service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithCAdESService(certificateVerifier);
+ service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
@@ -116,4 +105,9 @@ public void test() throws Exception {
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSignFourTimeTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSignFourTimeTest.java
index 9fc9839aba..48201486fb 100644
--- a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSignFourTimeTest.java
+++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSignFourTimeTest.java
@@ -12,89 +12,74 @@
import eu.europa.esig.dss.ASiCContainerType;
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters;
import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.policy.rules.Indication;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
-public class ASiCSCAdESLevelBSignFourTimeTest {
+public class ASiCSCAdESLevelBSignFourTimeTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text");
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier);
+ ASiCWithCAdESService service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithCAdESService(certificateVerifier);
+ service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithCAdESService(certificateVerifier);
+ service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(resignedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
resignedDocument = service.signDocument(resignedDocument, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithCAdESService(certificateVerifier);
+ service = new ASiCWithCAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(resignedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
resignedDocument = service.signDocument(resignedDocument, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
@@ -106,4 +91,9 @@ public void test() throws Exception {
assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId));
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-asic-xades/pom.xml b/dss-asic-xades/pom.xml
index 365c96d88b..8d0bb97df9 100644
--- a/dss-asic-xades/pom.xml
+++ b/dss-asic-xades/pom.xml
@@ -20,17 +20,10 @@
dss-xades
-
eu.europa.ec.joinup.sd-dss
dss-test
test
-
- eu.europa.ec.joinup.sd-dss
- dss-document
- test-jar
- test
-
\ No newline at end of file
diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/CertificatePoolSharingTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/CertificatePoolSharingTest.java
deleted file mode 100644
index 0f3c53016b..0000000000
--- a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/CertificatePoolSharingTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package eu.europa.esig.dss.asic.signature;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Date;
-import java.util.List;
-
-import org.junit.Test;
-
-import eu.europa.esig.dss.ASiCContainerType;
-import eu.europa.esig.dss.DSSDocument;
-import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
-import eu.europa.esig.dss.SignatureLevel;
-import eu.europa.esig.dss.SignatureValue;
-import eu.europa.esig.dss.ToBeSigned;
-import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.utils.Utils;
-import eu.europa.esig.dss.validation.AdvancedSignature;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
-import eu.europa.esig.dss.validation.SignedDocumentValidator;
-import eu.europa.esig.dss.validation.reports.Reports;
-
-public class CertificatePoolSharingTest {
-
- @Test
- public void test() throws Exception {
- DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text");
-
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
- ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters();
- signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
- signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
- signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
-
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier);
-
- ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign);
- DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
-
- SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
-
- List signatures = validator.getSignatures();
- assertTrue(Utils.isCollectionNotEmpty(signatures));
-
- Reports reports = validator.validateDocument();
- assertNotNull(reports);
- }
-
-}
diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBMultiFilesParallelTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBMultiFilesParallelTest.java
index ee8d3bc087..38a01a6993 100644
--- a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBMultiFilesParallelTest.java
+++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBMultiFilesParallelTest.java
@@ -17,7 +17,6 @@
import eu.europa.esig.dss.DSSUtils;
import eu.europa.esig.dss.InMemoryDocument;
import eu.europa.esig.dss.MimeType;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
@@ -26,17 +25,13 @@
import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters;
import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor;
import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.policy.rules.Indication;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
-public class ASiCEXAdESLevelBMultiFilesParallelTest {
+public class ASiCEXAdESLevelBMultiFilesParallelTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
@@ -44,39 +39,33 @@ public void test() throws Exception {
documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT));
documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT));
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier);
+ ASiCWithXAdESService service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithXAdESService(certificateVerifier);
+ service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
@@ -116,4 +105,9 @@ public void test() throws Exception {
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSignFourTimeTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSignFourTimeTest.java
index a94b34f491..63b5875247 100644
--- a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSignFourTimeTest.java
+++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSignFourTimeTest.java
@@ -12,17 +12,12 @@
import eu.europa.esig.dss.ASiCContainerType;
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters;
import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.policy.rules.Indication;
import eu.europa.esig.dss.validation.reports.Reports;
@@ -32,73 +27,63 @@
* @author axel.abinet
*
*/
-public class ASiCEXAdESLevelBSignFourTimeTest {
+public class ASiCEXAdESLevelBSignFourTimeTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text");
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier);
+ ASiCWithXAdESService service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithXAdESService(certificateVerifier);
+ service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithXAdESService(certificateVerifier);
+ service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(resignedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
resignedDocument = service.signDocument(resignedDocument, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithXAdESService(certificateVerifier);
+ service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(resignedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
resignedDocument = service.signDocument(resignedDocument, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
@@ -110,4 +95,9 @@ public void test() throws Exception {
assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId));
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBMultiFilesParallelTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBMultiFilesParallelTest.java
index 8cdff9b0ed..b0839455e6 100644
--- a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBMultiFilesParallelTest.java
+++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBMultiFilesParallelTest.java
@@ -20,7 +20,6 @@
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.InMemoryDocument;
import eu.europa.esig.dss.MimeType;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
@@ -29,17 +28,13 @@
import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters;
import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor;
import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.policy.rules.Indication;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
-public class ASiCSXAdESLevelBMultiFilesParallelTest {
+public class ASiCSXAdESLevelBMultiFilesParallelTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
@@ -47,35 +42,29 @@ public void test() throws Exception {
documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT));
documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT));
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier);
+ ASiCWithXAdESService service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithXAdESService(certificateVerifier);
+ service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
resignedDocument.writeTo(new FileOutputStream(new File("target/resigned.asics")));
@@ -83,7 +72,7 @@ public void test() throws Exception {
DSSDocument docToCheck = new FileDocument(new File("target/resigned.asics"));
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(docToCheck);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
@@ -124,4 +113,9 @@ public void test() throws Exception {
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSignFourTimeTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSignFourTimeTest.java
index 4ecf95c418..db58f45394 100644
--- a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSignFourTimeTest.java
+++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSignFourTimeTest.java
@@ -12,17 +12,12 @@
import eu.europa.esig.dss.ASiCContainerType;
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters;
import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.policy.rules.Indication;
import eu.europa.esig.dss.validation.reports.Reports;
@@ -32,73 +27,63 @@
* @author axel.abinet
*
*/
-public class ASiCSXAdESLevelBSignFourTimeTest {
+public class ASiCSXAdESLevelBSignFourTimeTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text");
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier);
+ ASiCWithXAdESService service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithXAdESService(certificateVerifier);
+ service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithXAdESService(certificateVerifier);
+ service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(resignedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
resignedDocument = service.signDocument(resignedDocument, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S);
- certificateVerifier = new CommonCertificateVerifier();
- service = new ASiCWithXAdESService(certificateVerifier);
+ service = new ASiCWithXAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(resignedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
resignedDocument = service.signDocument(resignedDocument, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
// reports.print();
@@ -111,4 +96,9 @@ public void test() throws Exception {
assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId));
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java
index c25849681d..33639fff4e 100644
--- a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java
+++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java
@@ -8,15 +8,12 @@
import eu.europa.esig.dss.ASiCContainerType;
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters;
import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService;
import eu.europa.esig.dss.signature.PKIFactoryAccess;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
@@ -28,9 +25,6 @@ public class ASiCE_XAdESLTACheckTimeStampIDTest extends PKIFactoryAccess {
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text");
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
signatureParameters.setSigningCertificate(getSigningCert());
diff --git a/dss-cades/pom.xml b/dss-cades/pom.xml
index 20f28eb26c..67a4b17625 100644
--- a/dss-cades/pom.xml
+++ b/dss-cades/pom.xml
@@ -24,17 +24,5 @@
dss-test
test
-
- eu.europa.ec.joinup.sd-dss
- dss-service
- test
-
-
- eu.europa.ec.joinup.sd-dss
- dss-document
- test-jar
- test
-
-
\ No newline at end of file
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/extension/ExtendToCAdESLtaTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/extension/ExtendToCAdESLtaTest.java
index 532168bdb6..ef004ff177 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/extension/ExtendToCAdESLtaTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/extension/ExtendToCAdESLtaTest.java
@@ -12,13 +12,10 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.DSSException;
import eu.europa.esig.dss.FileDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
import eu.europa.esig.dss.cades.signature.CAdESService;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
@@ -26,7 +23,7 @@
/**
* Unit test to fix issue https://esig-dss.atlassian.net/browse/DSS-646
*/
-public class ExtendToCAdESLtaTest {
+public class ExtendToCAdESLtaTest extends PKIFactoryAccess {
private static final String SIGNED_DOC_PATH = "src/test/resources/validation/dss-646/CAdES_A_DETACHED.csig";
private static final String DETACHED_DOC_PATH = "src/test/resources/validation/dss-646/document.pdf";
@@ -34,7 +31,7 @@ public class ExtendToCAdESLtaTest {
@Test
public void testValidation() {
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(new FileDocument(SIGNED_DOC_PATH));
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
List detachedContents = new ArrayList();
detachedContents.add(new FileDocument(DETACHED_DOC_PATH));
validator.setDetachedContents(detachedContents);
@@ -51,10 +48,8 @@ public void testValidation() {
@Test(expected = DSSException.class)
public void testExtend() throws Exception {
- CertificateService certificateService = new CertificateService();
-
- CAdESService service = new CAdESService(new CommonCertificateVerifier());
- service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA256)));
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
+ service.setTspSource(getGoodTsa());
CAdESSignatureParameters parameters = new CAdESSignatureParameters();
parameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_LTA);
@@ -64,4 +59,10 @@ public void testExtend() throws Exception {
assertNotNull(extendDocument);
}
+ @Override
+ protected String getSigningAlias() {
+ // not for signing
+ return null;
+ }
+
}
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureDetachedTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureDetachedTest.java
index 53af19bb0e..92197e8eda 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureDetachedTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureDetachedTest.java
@@ -11,64 +11,53 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignaturePackaging;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
-public class CAdESDoubleSignatureDetachedTest {
+public class CAdESDoubleSignatureDetachedTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text");
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.DETACHED);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.DETACHED);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
List detachedContents = new ArrayList();
detachedContents.add(documentToSign);
signatureParameters.setDetachedContents(detachedContents);
- certificateVerifier = new CommonCertificateVerifier();
- service = new CAdESService(certificateVerifier);
+ service = new CAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument);
validator.setDetachedContents(detachedContents);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
@@ -80,4 +69,9 @@ public void test() throws Exception {
assertTrue(diagnosticData.isBLevelTechnicallyValid(id));
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureTest.java
index f9639666f4..5f1b09d603 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureTest.java
@@ -9,17 +9,12 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignaturePackaging;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
@@ -28,45 +23,39 @@
* @author axel.abinet
*
*/
-public class CAdESDoubleSignatureTest {
+public class CAdESDoubleSignatureTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text");
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
- privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
- certificateVerifier = new CommonCertificateVerifier();
- service = new CAdESService(certificateVerifier);
+ service = new CAdESService(getCompleteCertificateVerifier());
dataToSign = service.getDataToSign(signedDocument, signatureParameters);
- signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign);
+ signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
@@ -78,4 +67,10 @@ public void test() throws Exception {
assertTrue(diagnosticData.isBLevelTechnicallyValid(id));
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
+
}
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedDigestDocumentTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedDigestDocumentTest.java
index df7252c32b..02448a9249 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedDigestDocumentTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedDigestDocumentTest.java
@@ -39,7 +39,6 @@
import eu.europa.esig.dss.signature.AbstractPkiFactoryTestDocumentSignatureService;
import eu.europa.esig.dss.signature.DocumentSignatureService;
import eu.europa.esig.dss.utils.Utils;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
@@ -66,7 +65,7 @@ public void init() throws Exception {
@Override
protected Reports getValidationReport(final DSSDocument signedDocument) {
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
InMemoryDocument inMemoryDocument = new InMemoryDocument("Hello World !".getBytes(), "test.text");
byte[] bytes;
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedTest.java
index dc72d59d03..18d639cd26 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedTest.java
@@ -33,7 +33,6 @@
import eu.europa.esig.dss.SignaturePackaging;
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
import eu.europa.esig.dss.signature.DocumentSignatureService;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
@@ -61,7 +60,7 @@ public void init() throws Exception {
@Override
protected Reports getValidationReport(final DSSDocument signedDocument) {
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
List detachedContents = new ArrayList();
detachedContents.add(documentToSign);
validator.setDetachedContents(detachedContents);
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedWithContentTimestampTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedWithContentTimestampTest.java
index 28f5459821..076a09eb9f 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedWithContentTimestampTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBDetachedWithContentTimestampTest.java
@@ -38,7 +38,6 @@
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
import eu.europa.esig.dss.client.tsp.OnlineTSPSource;
import eu.europa.esig.dss.signature.DocumentSignatureService;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.TimestampToken;
import eu.europa.esig.dss.validation.reports.Reports;
@@ -74,7 +73,7 @@ public void init() throws Exception {
@Override
protected Reports getValidationReport(final DSSDocument signedDocument) {
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
List detachedContents = new ArrayList();
detachedContents.add(documentToSign);
validator.setDetachedContents(detachedContents);
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBWithTwoContentTimestampsTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBWithTwoContentTimestampsTest.java
index 10e0d3e68f..85b634bf0f 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBWithTwoContentTimestampsTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBWithTwoContentTimestampsTest.java
@@ -36,8 +36,6 @@
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
import eu.europa.esig.dss.client.tsp.OnlineTSPSource;
import eu.europa.esig.dss.signature.DocumentSignatureService;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.TimestampToken;
import eu.europa.esig.dss.x509.CertificatePool;
import eu.europa.esig.dss.x509.TimestampType;
@@ -70,8 +68,7 @@ public void init() throws Exception {
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
signatureParameters.setContentTimestamps(Arrays.asList(contentTimestamp1, contentTimestamp2));
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- service = new CAdESService(certificateVerifier);
+ service = new CAdESService(getCompleteCertificateVerifier());
}
@Override
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/DSS798Test.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/DSS798Test.java
index 48941f7a0f..d5d4e8a248 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/DSS798Test.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/DSS798Test.java
@@ -12,51 +12,40 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.DSSException;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignaturePackaging;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.SimpleReport;
-public class DSS798Test {
+public class DSS798Test extends PKIFactoryAccess {
@Test(expected = DSSException.class)
public void testExtendDetachedWithoutFile() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello".getBytes(Charsets.UTF_8), "bin.bin");
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.DETACHED);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
// Level B
ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
// Level T without detached document
- CertificateVerifier certificateVerifierExtend = new CommonCertificateVerifier();
- CAdESService serviceExtend = new CAdESService(certificateVerifierExtend);
- serviceExtend.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA256)));
+ CAdESService serviceExtend = new CAdESService(getCompleteCertificateVerifier());
+ serviceExtend.setTspSource(getGoodTsa());
CAdESSignatureParameters parametersExtend = new CAdESSignatureParameters();
parametersExtend.setSignatureLevel(SignatureLevel.CAdES_BASELINE_T);
@@ -68,28 +57,23 @@ public void testExtendDetachedWithFile() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello".getBytes(Charsets.UTF_8), "bin.bin");
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.DETACHED);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
// Level B
ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
// Level T with detached document
- CertificateVerifier certificateVerifierExtend = new CommonCertificateVerifier();
- CAdESService serviceExtend = new CAdESService(certificateVerifierExtend);
- serviceExtend.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA256)));
+ CAdESService serviceExtend = new CAdESService(getCompleteCertificateVerifier());
+ serviceExtend.setTspSource(getGoodTsa());
CAdESSignatureParameters parametersExtend = new CAdESSignatureParameters();
parametersExtend.setSignatureLevel(SignatureLevel.CAdES_BASELINE_T);
@@ -97,7 +81,7 @@ public void testExtendDetachedWithFile() throws Exception {
DSSDocument extendedDocument = serviceExtend.extendDocument(signedDocument, parametersExtend);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(extendedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
validator.setDetachedContents(Arrays.asList(documentToSign));
Reports reports = validator.validateDocument();
reports.print();
@@ -106,4 +90,9 @@ public void testExtendDetachedWithFile() throws Exception {
assertEquals(SignatureLevel.CAdES_BASELINE_T.toString(), simpleReport.getSignatureFormat(simpleReport.getFirstSignatureId()));
}
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
+
}
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESBExtendToLTACheckTimeStampIDTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESBExtendToLTACheckTimeStampIDTest.java
index 312d0653fd..d06a6d7e8b 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESBExtendToLTACheckTimeStampIDTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESBExtendToLTACheckTimeStampIDTest.java
@@ -7,46 +7,36 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignaturePackaging;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
import eu.europa.esig.dss.cades.signature.CAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
import eu.europa.esig.dss.validation.reports.wrapper.TimestampWrapper;
-public class CAdESBExtendToLTACheckTimeStampIDTest {
+public class CAdESBExtendToLTACheckTimeStampIDTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World".getBytes());
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
- service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1)));
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
+ service.setTspSource(getGoodTsa());
ToBeSigned toBeSigned = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, toBeSigned);
+ SignatureValue signatureValue = getToken().sign(toBeSigned, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_LTA);
@@ -54,7 +44,7 @@ public void test() throws Exception {
signedDocument = service.extendDocument(signedDocument, signatureParameters);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports report = validator.validateDocument();
// report.print();
@@ -64,4 +54,10 @@ public void test() throws Exception {
Assert.assertEquals(signatureId, wrapper.getSignedObjects().getSignedSignature().get(0).getId());
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
+
}
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESLTACheckTimeStampIDTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESLTACheckTimeStampIDTest.java
index 78c0c86b59..4fe9d9bb38 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESLTACheckTimeStampIDTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESLTACheckTimeStampIDTest.java
@@ -7,50 +7,40 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignaturePackaging;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
import eu.europa.esig.dss.cades.signature.CAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
import eu.europa.esig.dss.validation.reports.wrapper.TimestampWrapper;
-public class CAdESLTACheckTimeStampIDTest {
+public class CAdESLTACheckTimeStampIDTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World".getBytes());
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_LTA);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
- service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1)));
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
+ service.setTspSource(getGoodTsa());
ToBeSigned toBeSigned = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, toBeSigned);
+ SignatureValue signatureValue = getToken().sign(toBeSigned, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
final DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports report = validator.validateDocument();
// report.print();
@@ -60,4 +50,9 @@ public void test() throws Exception {
Assert.assertEquals(signatureId, wrapper.getSignedObjects().getSignedSignature().get(0).getId());
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESLTACheckTimeStampedTimestampIDTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESLTACheckTimeStampedTimestampIDTest.java
index 5f48cb9c25..ae9038d9fc 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESLTACheckTimeStampedTimestampIDTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESLTACheckTimeStampedTimestampIDTest.java
@@ -7,51 +7,41 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignaturePackaging;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
import eu.europa.esig.dss.cades.signature.CAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData;
import eu.europa.esig.dss.validation.reports.wrapper.TimestampWrapper;
import eu.europa.esig.dss.x509.TimestampType;
-public class CAdESLTACheckTimeStampedTimestampIDTest {
+public class CAdESLTACheckTimeStampedTimestampIDTest extends PKIFactoryAccess {
@Test
public void test() throws Exception {
DSSDocument documentToSign = new InMemoryDocument("Hello World".getBytes());
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_LTA);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
- service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1)));
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
+ service.setTspSource(getGoodTsa());
ToBeSigned toBeSigned = service.getDataToSign(documentToSign, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, toBeSigned);
+ SignatureValue signatureValue = getToken().sign(toBeSigned, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
final DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports report = validator.validateDocument();
// report.print();
@@ -63,4 +53,9 @@ public void test() throws Exception {
}
}
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CMSTimestampValidatorTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CMSTimestampValidatorTest.java
index ad212ab5f2..f322289e00 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CMSTimestampValidatorTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CMSTimestampValidatorTest.java
@@ -9,26 +9,24 @@
import eu.europa.esig.dss.DSSUtils;
import eu.europa.esig.dss.DigestAlgorithm;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.utils.Utils;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.TimestampToken;
+import eu.europa.esig.dss.x509.tsp.TSPSource;
-public class CMSTimestampValidatorTest {
+public class CMSTimestampValidatorTest extends PKIFactoryAccess {
@Test
public void testValidator() throws Exception {
- CertificateService certificateService = new CertificateService();
- MockTSPSource mockTSPSource = new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA256));
+
+ TSPSource tspSource = getGoodTsa();
byte[] data = new byte[] { 1, 2, 3 };
- TimeStampToken timeStampResponse = mockTSPSource.getTimeStampResponse(DigestAlgorithm.SHA256, DSSUtils.digest(DigestAlgorithm.SHA256, data));
+ TimeStampToken timeStampResponse = tspSource.getTimeStampResponse(DigestAlgorithm.SHA256, DSSUtils.digest(DigestAlgorithm.SHA256, data));
CMSTimestampValidator validator = new CMSTimestampValidator(new InMemoryDocument(timeStampResponse.getEncoded()));
validator.setTimestampedData(new InMemoryDocument(data));
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
assertTrue(Utils.isCollectionEmpty(validator.getSignatures()));
@@ -38,4 +36,10 @@ public void testValidator() throws Exception {
assertTrue(timestamp.isMessageImprintDataIntact());
}
+ @Override
+ protected String getSigningAlias() {
+ // not for signing
+ return null;
+ }
+
}
diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/GetOriginalDocumentTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/GetOriginalDocumentTest.java
index f72cf9cf1c..931685ce98 100644
--- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/GetOriginalDocumentTest.java
+++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/GetOriginalDocumentTest.java
@@ -10,23 +10,18 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.DSSException;
import eu.europa.esig.dss.InMemoryDocument;
-import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureLevel;
import eu.europa.esig.dss.SignaturePackaging;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.cades.CAdESSignatureParameters;
import eu.europa.esig.dss.cades.signature.CAdESService;
-import eu.europa.esig.dss.test.TestUtils;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
+import eu.europa.esig.dss.signature.PKIFactoryAccess;
import eu.europa.esig.dss.utils.Utils;
-import eu.europa.esig.dss.validation.CertificateVerifier;
-import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
import eu.europa.esig.dss.validation.reports.Reports;
-public class GetOriginalDocumentTest {
+public class GetOriginalDocumentTest extends PKIFactoryAccess {
private static String HELLO_WORLD = "HELLO WORLD !";
@@ -34,25 +29,21 @@ public class GetOriginalDocumentTest {
public final void getOriginalDocumentFromEnvelopingSignature() throws Exception {
DSSDocument document = new InMemoryDocument(HELLO_WORLD.getBytes());
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(document, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
final DSSDocument signedDocument = service.signDocument(document, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
List results = validator.getOriginalDocuments(reports.getDiagnosticData().getFirstSignatureId());
@@ -67,25 +58,21 @@ public final void getOriginalDocumentFromEnvelopingSignature() throws Exception
public final void getOriginalDocumentFromEnvelopingSignatureWithBase64EncodedContent() throws Exception {
DSSDocument document = new InMemoryDocument(Base64.encode(HELLO_WORLD.getBytes()));
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(document, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
final DSSDocument signedDocument = service.signDocument(document, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
List results = validator.getOriginalDocuments(reports.getDiagnosticData().getFirstSignatureId());
@@ -100,27 +87,28 @@ public final void getOriginalDocumentFromEnvelopingSignatureWithBase64EncodedCon
public final void getOriginalDocumentFromDetachedSignature() throws Exception {
DSSDocument document = new InMemoryDocument(HELLO_WORLD.getBytes());
- CertificateService certificateService = new CertificateService();
- MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256);
-
CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters();
signatureParameters.bLevel().setSigningDate(new Date());
- signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate());
- signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain());
+ signatureParameters.setSigningCertificate(getSigningCert());
+ signatureParameters.setCertificateChain(getCertificateChain());
signatureParameters.setSignaturePackaging(SignaturePackaging.DETACHED);
signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
- CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
- CAdESService service = new CAdESService(certificateVerifier);
+ CAdESService service = new CAdESService(getCompleteCertificateVerifier());
ToBeSigned dataToSign = service.getDataToSign(document, signatureParameters);
- SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign);
+ SignatureValue signatureValue = getToken().sign(dataToSign, signatureParameters.getDigestAlgorithm(), getPrivateKeyEntry());
final DSSDocument signedDocument = service.signDocument(document, signatureParameters, signatureValue);
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument);
- validator.setCertificateVerifier(new CommonCertificateVerifier());
+ validator.setCertificateVerifier(getCompleteCertificateVerifier());
Reports reports = validator.validateDocument();
validator.getOriginalDocuments(reports.getDiagnosticData().getFirstSignatureId());
}
+
+ @Override
+ protected String getSigningAlias() {
+ return GOOD_USER;
+ }
}
diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/Cookbook.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/Cookbook.java
index c357773164..0eabdab062 100644
--- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/Cookbook.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/Cookbook.java
@@ -27,8 +27,8 @@
import eu.europa.esig.dss.DSSException;
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.SignatureAlgorithm;
+import eu.europa.esig.dss.cookbook.mock.MockTSPSource;
import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
import eu.europa.esig.dss.token.AbstractSignatureTokenConnection;
import eu.europa.esig.dss.token.DSSPrivateKeyEntry;
import eu.europa.esig.dss.token.Pkcs12SignatureToken;
diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBAllDataObjectsTimestamp.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBAllDataObjectsTimestamp.java
index acd8e58b82..baa03a278c 100644
--- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBAllDataObjectsTimestamp.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBAllDataObjectsTimestamp.java
@@ -35,8 +35,8 @@
import eu.europa.esig.dss.TimestampParameters;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.cookbook.example.Cookbook;
+import eu.europa.esig.dss.cookbook.mock.MockTSPSource;
import eu.europa.esig.dss.cookbook.timestamp.TimestampService;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.TimestampToken;
import eu.europa.esig.dss.x509.CertificatePool;
diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateDetached.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateDetached.java
index 97fe83fac3..9696181f6e 100644
--- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateDetached.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateDetached.java
@@ -27,7 +27,7 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.cookbook.example.Cookbook;
-import eu.europa.esig.dss.test.mock.MockServiceInfo;
+import eu.europa.esig.dss.cookbook.mock.MockServiceInfo;
import eu.europa.esig.dss.tsl.ServiceInfo;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateExtendedSignedXmlXadesBtoT.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateExtendedSignedXmlXadesBtoT.java
index 7ebe0d5331..ddee0d7e5b 100644
--- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateExtendedSignedXmlXadesBtoT.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateExtendedSignedXmlXadesBtoT.java
@@ -25,9 +25,9 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.cookbook.example.Cookbook;
+import eu.europa.esig.dss.cookbook.mock.MockServiceInfo;
import eu.europa.esig.dss.cookbook.mock.MockTSLCertificateSource;
import eu.europa.esig.dss.cookbook.sources.AlwaysValidOCSPSource;
-import eu.europa.esig.dss.test.mock.MockServiceInfo;
import eu.europa.esig.dss.tsl.ServiceInfo;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedPdfPadesB.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedPdfPadesB.java
index aa67f403ab..b9964a9e4c 100644
--- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedPdfPadesB.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedPdfPadesB.java
@@ -25,9 +25,9 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.cookbook.example.Cookbook;
+import eu.europa.esig.dss.cookbook.mock.MockServiceInfo;
import eu.europa.esig.dss.cookbook.mock.MockTSLCertificateSource;
import eu.europa.esig.dss.cookbook.sources.AlwaysValidOCSPSource;
-import eu.europa.esig.dss.test.mock.MockServiceInfo;
import eu.europa.esig.dss.tsl.ServiceInfo;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlCadesB.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlCadesB.java
index 8ba0de6cdd..21b99bd8a5 100644
--- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlCadesB.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlCadesB.java
@@ -25,9 +25,9 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.cookbook.example.Cookbook;
+import eu.europa.esig.dss.cookbook.mock.MockServiceInfo;
import eu.europa.esig.dss.cookbook.mock.MockTSLCertificateSource;
import eu.europa.esig.dss.cookbook.sources.AlwaysValidOCSPSource;
-import eu.europa.esig.dss.test.mock.MockServiceInfo;
import eu.europa.esig.dss.tsl.ServiceInfo;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBWithCustomPolicy.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBWithCustomPolicy.java
index 6e62aceae7..de6957a31f 100644
--- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBWithCustomPolicy.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBWithCustomPolicy.java
@@ -25,9 +25,9 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.cookbook.example.Cookbook;
+import eu.europa.esig.dss.cookbook.mock.MockServiceInfo;
import eu.europa.esig.dss.cookbook.mock.MockTSLCertificateSource;
import eu.europa.esig.dss.cookbook.sources.AlwaysValidOCSPSource;
-import eu.europa.esig.dss.test.mock.MockServiceInfo;
import eu.europa.esig.dss.tsl.ServiceInfo;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesLT.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesLT.java
index 5fd0254ea7..41711f79e0 100644
--- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesLT.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesLT.java
@@ -25,9 +25,9 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.cookbook.example.Cookbook;
+import eu.europa.esig.dss.cookbook.mock.MockServiceInfo;
import eu.europa.esig.dss.cookbook.mock.MockTSLCertificateSource;
import eu.europa.esig.dss.cookbook.sources.AlwaysValidOCSPSource;
-import eu.europa.esig.dss.test.mock.MockServiceInfo;
import eu.europa.esig.dss.tsl.ServiceInfo;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
diff --git a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockCRLSource.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockCRLSource.java
similarity index 98%
rename from dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockCRLSource.java
rename to dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockCRLSource.java
index f2ec3c2ea1..8661ba7b2e 100644
--- a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockCRLSource.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockCRLSource.java
@@ -18,7 +18,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package eu.europa.esig.dss.test.mock;
+package eu.europa.esig.dss.cookbook.mock;
import java.io.IOException;
import java.io.InputStream;
diff --git a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockEmptyTSLCertificateSource.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockEmptyTSLCertificateSource.java
similarity index 98%
rename from dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockEmptyTSLCertificateSource.java
rename to dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockEmptyTSLCertificateSource.java
index b4aa1471f1..3a6b494fc4 100644
--- a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockEmptyTSLCertificateSource.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockEmptyTSLCertificateSource.java
@@ -18,7 +18,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package eu.europa.esig.dss.test.mock;
+package eu.europa.esig.dss.cookbook.mock;
import java.util.Calendar;
import java.util.Collections;
diff --git a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockOCSPSource.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockOCSPSource.java
similarity index 98%
rename from dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockOCSPSource.java
rename to dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockOCSPSource.java
index 6ae838ea7c..12a45c83e9 100644
--- a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockOCSPSource.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockOCSPSource.java
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package eu.europa.esig.dss.test.mock;
+package eu.europa.esig.dss.cookbook.mock;
import java.io.InputStream;
import java.util.ArrayList;
diff --git a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockServiceInfo.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockServiceInfo.java
similarity index 98%
rename from dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockServiceInfo.java
rename to dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockServiceInfo.java
index 4eda23e893..83eb38438b 100644
--- a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockServiceInfo.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockServiceInfo.java
@@ -18,7 +18,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package eu.europa.esig.dss.test.mock;
+package eu.europa.esig.dss.cookbook.mock;
import java.util.Calendar;
import java.util.Collections;
diff --git a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockSignatureTokenConnection.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockSignatureTokenConnection.java
similarity index 96%
rename from dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockSignatureTokenConnection.java
rename to dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockSignatureTokenConnection.java
index 063f08d489..c3dac1d945 100644
--- a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockSignatureTokenConnection.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockSignatureTokenConnection.java
@@ -18,7 +18,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package eu.europa.esig.dss.test.mock;
+package eu.europa.esig.dss.cookbook.mock;
import java.security.Signature;
import java.util.List;
@@ -29,6 +29,7 @@
import eu.europa.esig.dss.SignatureAlgorithm;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
+import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
import eu.europa.esig.dss.token.AbstractSignatureTokenConnection;
import eu.europa.esig.dss.token.DSSPrivateKeyEntry;
diff --git a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockTSPSource.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockTSPSource.java
similarity index 98%
rename from dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockTSPSource.java
rename to dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockTSPSource.java
index 199420a44e..2375ec736f 100644
--- a/dss-test/src/main/java/eu/europa/esig/dss/test/mock/MockTSPSource.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/mock/MockTSPSource.java
@@ -18,7 +18,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package eu.europa.esig.dss.test.mock;
+package eu.europa.esig.dss.cookbook.mock;
import java.math.BigInteger;
import java.security.PrivateKey;
@@ -62,6 +62,7 @@
import eu.europa.esig.dss.DSSException;
import eu.europa.esig.dss.DSSRevocationUtils;
import eu.europa.esig.dss.DigestAlgorithm;
+import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry;
import eu.europa.esig.dss.x509.CertificateToken;
import eu.europa.esig.dss.x509.tsp.TSPSource;
diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/CheckCertificate.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/CheckCertificate.java
index 2e9a3e3d7b..3eacda7e4d 100644
--- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/CheckCertificate.java
+++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/CheckCertificate.java
@@ -26,9 +26,9 @@
import eu.europa.esig.dss.client.crl.OnlineCRLSource;
import eu.europa.esig.dss.client.ocsp.OnlineOCSPSource;
import eu.europa.esig.dss.cookbook.example.Cookbook;
-import eu.europa.esig.dss.test.mock.MockCRLSource;
-import eu.europa.esig.dss.test.mock.MockEmptyTSLCertificateSource;
-import eu.europa.esig.dss.test.mock.MockOCSPSource;
+import eu.europa.esig.dss.cookbook.mock.MockCRLSource;
+import eu.europa.esig.dss.cookbook.mock.MockEmptyTSLCertificateSource;
+import eu.europa.esig.dss.cookbook.mock.MockOCSPSource;
import eu.europa.esig.dss.validation.CertificateVerifier;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignatureValidationContext;
diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/CookbookTools.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/CookbookTools.java
index 8c66fea174..1fd1407db9 100644
--- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/CookbookTools.java
+++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/CookbookTools.java
@@ -10,8 +10,8 @@
import eu.europa.esig.dss.DSSUtils;
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.SignatureAlgorithm;
+import eu.europa.esig.dss.cookbook.mock.MockTSPSource;
import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
import eu.europa.esig.dss.token.AbstractSignatureTokenConnection;
import eu.europa.esig.dss.token.DSSPrivateKeyEntry;
import eu.europa.esig.dss.token.Pkcs12SignatureToken;
diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTTest.java
index 97a9906542..25e255a894 100644
--- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTTest.java
+++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTTest.java
@@ -33,8 +33,8 @@
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.ToBeSigned;
import eu.europa.esig.dss.cookbook.example.CookbookTools;
+import eu.europa.esig.dss.cookbook.mock.MockTSPSource;
import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.test.mock.MockTSPSource;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.xades.XAdESSignatureParameters;
import eu.europa.esig.dss.xades.signature.XAdESService;
diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBTest.java
index 598c112a00..c67df0df4d 100644
--- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBTest.java
+++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBTest.java
@@ -30,9 +30,9 @@
import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.FileDocument;
import eu.europa.esig.dss.cookbook.example.CookbookTools;
+import eu.europa.esig.dss.cookbook.mock.MockServiceInfo;
import eu.europa.esig.dss.cookbook.mock.MockTSLCertificateSource;
import eu.europa.esig.dss.cookbook.sources.AlwaysValidOCSPSource;
-import eu.europa.esig.dss.test.mock.MockServiceInfo;
import eu.europa.esig.dss.tsl.ServiceInfo;
import eu.europa.esig.dss.validation.CommonCertificateVerifier;
import eu.europa.esig.dss.validation.SignedDocumentValidator;
diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateXmlXadesLTWithOnlineSourcesTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateXmlXadesLTWithOnlineSourcesTest.java
index 2cc2b66fcc..48a34c4b00 100644
--- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateXmlXadesLTWithOnlineSourcesTest.java
+++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateXmlXadesLTWithOnlineSourcesTest.java
@@ -34,7 +34,7 @@
import eu.europa.esig.dss.client.http.commons.FileCacheDataLoader;
import eu.europa.esig.dss.client.ocsp.OnlineOCSPSource;
import eu.europa.esig.dss.cookbook.example.CookbookTools;
-import eu.europa.esig.dss.test.mock.MockServiceInfo;
+import eu.europa.esig.dss.cookbook.mock.MockServiceInfo;
import eu.europa.esig.dss.tsl.TrustedListsCertificateSource;
import eu.europa.esig.dss.tsl.service.TSLRepository;
import eu.europa.esig.dss.tsl.service.TSLValidationJob;
diff --git a/dss-document/pom.xml b/dss-document/pom.xml
index 2580660118..7cfaa37c1a 100644
--- a/dss-document/pom.xml
+++ b/dss-document/pom.xml
@@ -11,25 +11,38 @@
dss-document
DSS Document
- DSS Document contains the code for the creation and validation of XAdES, CAdES, PAdES and ASiC signatures._
+ DSS Document contains the code for the creation and validation of XAdES, CAdES, PAdES and ASiC signatures.
eu.europa.ec.joinup.sd-dss
dss-spi
-
- eu.europa.ec.joinup.sd-dss
- dss-reports
-
eu.europa.ec.joinup.sd-dss
validation-policy
-
+
+
+ ch.qos.logback
+ logback-classic
+ test
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+
+
+
eu.europa.ec.joinup.sd-dss
- dss-test
+ dss-utils-google-guava
test
diff --git a/dss-document/src/main/java/eu/europa/esig/dss/validation/SignatureValidationContext.java b/dss-document/src/main/java/eu/europa/esig/dss/validation/SignatureValidationContext.java
index b26e9bbeb8..4298f3d50c 100644
--- a/dss-document/src/main/java/eu/europa/esig/dss/validation/SignatureValidationContext.java
+++ b/dss-document/src/main/java/eu/europa/esig/dss/validation/SignatureValidationContext.java
@@ -413,15 +413,18 @@ private List getRevocationData(final CertificateToken certToken
List revocations = new ArrayList();
// ALL Embedded revocation data
- OCSPAndCRLCertificateVerifier offlineVerifier = new OCSPAndCRLCertificateVerifier(signatureCRLSource, signatureOCSPSource, validationCertificatePool);
- RevocationToken ocspToken = offlineVerifier.checkOCSP(certToken);
- if (ocspToken != null) {
- revocations.add(ocspToken);
- }
+ if (signatureCRLSource != null || signatureOCSPSource != null) {
+ OCSPAndCRLCertificateVerifier offlineVerifier = new OCSPAndCRLCertificateVerifier(signatureCRLSource, signatureOCSPSource,
+ validationCertificatePool);
+ RevocationToken ocspToken = offlineVerifier.checkOCSP(certToken);
+ if (ocspToken != null) {
+ revocations.add(ocspToken);
+ }
- RevocationToken crlToken = offlineVerifier.checkCRL(certToken);
- if (crlToken != null) {
- revocations.add(crlToken);
+ RevocationToken crlToken = offlineVerifier.checkCRL(certToken);
+ if (crlToken != null) {
+ revocations.add(crlToken);
+ }
}
if (revocations.isEmpty()) {
diff --git a/dss-document/src/main/resources/custom-content-types.properties b/dss-document/src/main/resources/custom-content-types.properties
deleted file mode 100644
index 76c74f5278..0000000000
--- a/dss-document/src/main/resources/custom-content-types.properties
+++ /dev/null
@@ -1,274 +0,0 @@
-#sun.net.www MIME content-types table; version %I%, %G%
-#
-# Property fields:
-#
-# ::= 'description' '='
-# ::= 'file_extensions' '='
-# ::= 'icon' '='
-# ::= 'browser' | 'application' | 'save' | 'unknown'
-# ::= 'application' '='
-#
-
-#
-# The "we don't know anything about this data" type(s).
-# Used internally to mark unrecognized types.
-#
-content/unknown: description=Unknown Content
-unknown/unknown: description=Unknown Data Type
-
-#
-# The template we should use for temporary files when launching an application
-# to view a document of given type.
-#
-temp.file.template: c:\\temp\\%s
-
-#
-# The "real" types.
-#
-application/octet-stream: \
- description=Generic Binary Stream;\
- file_extensions=.saveme,.dump,.hqx,.arc,.obj,.lib,.bin,.exe,.zip,.gz
-
-application/oda: \
- description=ODA Document;\
- file_extensions=.oda
-
-application/pdf: \
- description=Adobe PDF Format;\
- file_extensions=.pdf
-
-application/postscript: \
- description=Postscript File;\
- file_extensions=.eps,.ai,.ps;\
- icon=ps
-
-application/rtf: \
- description=Wordpad Document;\
- file_extensions=.rtf;\
- action=application;\
- application=wordpad.exe %s
-
-application/x-dvi: \
- description=TeX DVI File;\
- file_extensions=.dvi
-
-application/x-hdf: \
- description=Hierarchical Data Format;\
- file_extensions=.hdf;\
- action=save
-
-application/x-latex: \
- description=LaTeX Source;\
- file_extensions=.latex
-
-application/x-netcdf: \
- description=Unidata netCDF Data Format;\
- file_extensions=.nc,.cdf;\
- action=save
-
-application/x-tex: \
- description=TeX Source;\
- file_extensions=.tex
-
-application/x-texinfo: \
- description=Gnu Texinfo;\
- file_extensions=.texinfo,.texi
-
-application/x-troff: \
- description=Troff Source;\
- file_extensions=.t,.tr,.roff
-
-application/x-troff-man: \
- description=Troff Manpage Source;\
- file_extensions=.man
-
-application/x-troff-me: \
- description=Troff ME Macros;\
- file_extensions=.me
-
-application/x-troff-ms: \
- description=Troff MS Macros;\
- file_extensions=.ms
-
-application/x-wais-source: \
- description=Wais Source;\
- file_extensions=.src,.wsrc
-
-application/zip: \
- description=Zip File;\
- file_extensions=.zip;\
- icon=zip;\
- action=save
-
-application/x-bcpio: \
- description=Old Binary CPIO Archive;\
- file_extensions=.bcpio;\
- action=save
-
-application/x-cpio: \
- description=Unix CPIO Archive;\
- file_extensions=.cpio;\
- action=save
-
-application/x-gtar: \
- description=Gnu Tar Archive;\
- file_extensions=.gtar;\
- icon=tar;\
- action=save
-
-application/x-shar: \
- description=Shell Archive;\
- file_extensions=.sh,.shar;\
- action=save
-
-application/x-sv4cpio: \
- description=SVR4 CPIO Archive;\
- file_extensions=.sv4cpio;\
- action=save
-
-application/x-sv4crc: \
- description=SVR4 CPIO with CRC;\
- file_extensions=.sv4crc;\
- action=save
-
-application/x-tar: \
- description=Tar Archive;\
- file_extensions=.tar;\
- icon=tar;\
- action=save
-
-application/x-ustar: \
- description=US Tar Archive;\
- file_extensions=.ustar;\
- action=save
-
-audio/basic: \
- description=Basic Audio;\
- file_extensions=.snd,.au;\
- icon=audio
-
-audio/x-aiff: \
- description=Audio Interchange Format File;\
- file_extensions=.aifc,.aif,.aiff;\
- icon=aiff
-
-audio/x-wav: \
- description=Wav Audio;\
- file_extensions=.wav;\
- icon=wav;\
- action=application;\
- application=mplayer.exe %s
-
-image/gif: \
- description=GIF Image;\
- file_extensions=.gif;\
- icon=gif;\
- action=browser
-
-image/ief: \
- description=Image Exchange Format;\
- file_extensions=.ief
-
-image/jpeg: \
- description=JPEG Image;\
- file_extensions=.jfif,.jfif-tbnl,.jpe,.jpg,.jpeg;\
- icon=jpeg;\
- action=browser
-
-image/tiff: \
- description=TIFF Image;\
- file_extensions=.tif,.tiff;\
- icon=tiff
-
-image/vnd.fpx: \
- description=FlashPix Image;\
- file_extensions=.fpx,.fpix
-
-image/x-cmu-rast: \
- description=CMU Raster Image;\
- file_extensions=.ras
-
-image/x-portable-anymap: \
- description=PBM Anymap Image;\
- file_extensions=.pnm
-
-image/x-portable-bitmap: \
- description=PBM Bitmap Image;\
- file_extensions=.pbm
-
-image/x-portable-graymap: \
- description=PBM Graymap Image;\
- file_extensions=.pgm
-
-image/x-portable-pixmap: \
- description=PBM Pixmap Image;\
- file_extensions=.ppm
-
-image/x-rgb: \
- description=RGB Image;\
- file_extensions=.rgb
-
-image/x-xbitmap: \
- description=X Bitmap Image;\
- file_extensions=.xbm,.xpm
-
-image/x-xwindowdump: \
- description=X Window Dump Image;\
- file_extensions=.xwd
-
-image/png: \
- description=PNG Image;\
- file_extensions=.png;\
- icon=png;\
- action=browser
-
-text/html: \
- description=HTML Document;\
- file_extensions=.htm,.html;\
- icon=html
-
-text/plain: \
- description=Plain Text;\
- file_extensions=.text,.c,.cc,.c++,.h,.pl,.txt,.java,.el;\
- icon=text;\
- action=browser
-
-text/tab-separated-values: \
- description=Tab Separated Values Text;\
- file_extensions=.tsv
-
-text/x-setext: \
- description=Structure Enhanced Text;\
- file_extensions=.etx
-
-video/mpeg: \
- description=MPEG Video Clip;\
- file_extensions=.mpg,.mpe,.mpeg;\
- icon=mpeg
-
-video/quicktime: \
- description=QuickTime Video Clip;\
- file_extensions=.mov,.qt
-
-application/x-troff-msvideo: \
- description=AVI Video;\
- file_extensions=.avi;\
- icon=avi;\
- action=application;\
- application=mplayer.exe %s
-
-video/x-sgi-movie: \
- description=SGI Movie;\
- file_extensions=.movie,.mv
-
-message/rfc822: \
- description=Internet Email Message;\
- file_extensions=.mime
-
-application/xml: \
- description=XML document;\
- file_extensions=.xml
-
-application/vnd.etsi.asic-s+zip: \
- description=ASiC-S container;\
- file_extensions=.asics
\ No newline at end of file
diff --git a/dss-document/src/test/java/eu/europa/esig/dss/DeterministicIdGenerationTest.java b/dss-document/src/test/java/eu/europa/esig/dss/DeterministicIdGenerationTest.java
index a492c5b4a3..c17ef29e99 100644
--- a/dss-document/src/test/java/eu/europa/esig/dss/DeterministicIdGenerationTest.java
+++ b/dss-document/src/test/java/eu/europa/esig/dss/DeterministicIdGenerationTest.java
@@ -22,24 +22,22 @@
import static org.junit.Assert.assertNotEquals;
+import java.io.FileInputStream;
import java.util.Arrays;
import java.util.List;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
-import eu.europa.esig.dss.test.gen.CertificateService;
-import eu.europa.esig.dss.token.DSSPrivateKeyEntry;
+import eu.europa.esig.dss.x509.CertificateToken;
@RunWith(Parameterized.class)
public class DeterministicIdGenerationTest {
- private static SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.RSA_SHA256;
-
- private static DSSPrivateKeyEntry privateKeyEntry;
+ private CertificateToken signingCert;
@Parameters
public static List