aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);