aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-16 13:09:59 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-16 13:09:59 +0000
commit16d89bf90c5ff83fd3c47f6057a708b98c79271b (patch)
treed993e53fcf31b2f000e2d31732f08e328465bdd2 /src/main/java/at/gv/egiz
parentd40090e3b400fe3de4ffa7179cddbe23f7b593bd (diff)
downloadpdf-as-3-16d89bf90c5ff83fd3c47f6057a708b98c79271b.tar.gz
pdf-as-3-16d89bf90c5ff83fd3c47f6057a708b98c79271b.tar.bz2
pdf-as-3-16d89bf90c5ff83fd3c47f6057a708b98c79271b.zip
verify(VerifyAfterReconstructXMLDsigParameters) now uses the signatureDevice which was used in reconstructXMLDsig(...) if non is set explicitly in the VerifyAfterReconstructXMLDsigParameters
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@716 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java2
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java26
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java10
3 files changed, 26 insertions, 12 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java
index b490848..7064255 100644
--- a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java
+++ b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java
@@ -26,7 +26,7 @@ public class VerifyAfterReconstructXMLDsigParameters {
* {@link Constants#SIGNATURE_DEVICE_BKU}.
* </p>
*/
- protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA;
+ protected String signatureDevice;
/**
* Allows to pass a VerificationTime to the signature device.
diff --git a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java b/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java
index 078167d..48e1c14 100644
--- a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java
+++ b/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java
@@ -2,6 +2,7 @@ package at.gv.egiz.pdfas.api.xmldsig;
import java.util.List;
+import at.gv.egiz.pdfas.api.commons.Constants;
import at.gv.egiz.pdfas.api.commons.SignatureInformation;
/**
@@ -12,19 +13,28 @@ import at.gv.egiz.pdfas.api.commons.SignatureInformation;
* @author exthex
*/
public class ReconstructXMLDsigResult {
-
+
private List extendedSignatures;
+ private String device;
+
+ /**
+ *
+ * @param extendedSignatureInfos
+ * @param signatureDevice
+ */
+ public ReconstructXMLDsigResult(List extendedSignatureInfos, String signatureDevice) {
+ this.extendedSignatures = extendedSignatureInfos;
+ this.device = signatureDevice;
+ }
+
/**
- * Set the extendedSignatures.
+ * Get the signature device that was used to create this result.
*
- * @param extendedSignatures
- * The list of {@link ExtendedSignatureInformation}s to set
- * @return this
+ * @return {@link Constants#SIGNATURE_DEVICE_MOA} or {@link Constants#SIGNATURE_DEVICE_BKU}
*/
- public ReconstructXMLDsigResult setExtendedSignatures(List extendedSignatures) {
- this.extendedSignatures = extendedSignatures;
- return this;
+ public String getDevice() {
+ return device;
}
/**
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
index 3433565..96e5ad1 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
@@ -541,7 +541,7 @@ public class PdfAsObject implements PdfAs
}
}
- return new ReconstructXMLDsigResult().setExtendedSignatures(extendedSignatureInfos);
+ return new ReconstructXMLDsigResult(extendedSignatureInfos, reconstructXMLDsigParameters.getSignatureDevice());
}
/**
@@ -553,8 +553,12 @@ public class PdfAsObject implements PdfAs
try {
List extSignatures = verifyAfterReconstructXMLDsigParameters.getReconstructXMLDsigResult().getExtendedSignatures();
+ String signatureDevice = verifyAfterReconstructXMLDsigParameters.getSignatureDevice();
+ if (signatureDevice == null){
+ signatureDevice = verifyAfterReconstructXMLDsigParameters.getReconstructXMLDsigResult().getDevice();
+ }
List results = PdfAS.verifyExtendedSignatureHolders(extSignatures,
- verifyAfterReconstructXMLDsigParameters.getSignatureDevice(),
+ signatureDevice,
verifyAfterReconstructXMLDsigParameters.isReturnHashInputData(),
verifyAfterReconstructXMLDsigParameters.getVerificationTime(), verifyAfterReconstructXMLDsigParameters.getVerifySignatureIndex());
@@ -585,7 +589,7 @@ public class PdfAsObject implements PdfAs
vrs.add(vr);
}
- VerifyResultsImpl verifyResults = new VerifyResultsImpl(vrs);
+ VerifyResultsImpl verifyResults = new VerifyResultsImpl(vrs);
return verifyResults;
} catch (java.lang.OutOfMemoryError e) {
throw new OutOfMemoryException(ErrorCode.OUT_OF_MEMORY_ERROR, "Insufficient memory allocated to virtual machine. Start Java with parameters \"-Xms128m -Xmx786m -XX:MaxPermSize=256m\".", e);