From 16d89bf90c5ff83fd3c47f6057a708b98c79271b Mon Sep 17 00:00:00 2001 From: pdanner Date: Thu, 16 Dec 2010 13:09:59 +0000 Subject: 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 --- .../VerifyAfterReconstructXMLDsigParameters.java | 2 +- .../api/xmldsig/ReconstructXMLDsigResult.java | 26 +++++++++++++++------- .../at/gv/egiz/pdfas/impl/api/PdfAsObject.java | 10 ++++++--- 3 files changed, 26 insertions(+), 12 deletions(-) (limited to 'src/main/java/at/gv/egiz') 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}. *

*/ - 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); -- cgit v1.2.3