aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-legacy/src
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-07-10 12:09:05 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-07-10 12:09:05 +0200
commitaf90012c848711a4c9010dbcf71694dbfbca0e86 (patch)
treecd40f8fab90b6a2fe62359a404497d369d82ece0 /pdf-as-legacy/src
parent83a573238984575b76ab06dca677831f4a650534 (diff)
downloadpdf-as-4-af90012c848711a4c9010dbcf71694dbfbca0e86.tar.gz
pdf-as-4-af90012c848711a4c9010dbcf71694dbfbca0e86.tar.bz2
pdf-as-4-af90012c848711a4c9010dbcf71694dbfbca0e86.zip
Integrity verification of Signature after Signature creation to ensure correct signed Document
Diffstat (limited to 'pdf-as-legacy/src')
-rw-r--r--pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java
index 9ed02053..bef3b01f 100644
--- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java
+++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java
@@ -59,6 +59,7 @@ import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyResult;
import at.gv.egiz.pdfas.lib.impl.SignaturePositionImpl;
+import at.gv.egiz.pdfas.lib.impl.StatusRequestImpl;
public class PdfAsObject implements PdfAs {
@@ -82,14 +83,22 @@ public class PdfAsObject implements PdfAs {
}
SignatureDetailInformationWrapper sdi = (SignatureDetailInformationWrapper) signatureDetailInformation;
- StatusRequest request = sdi.getStatus();
+ StatusRequest statusRequest = sdi.getStatus();
+
+ if (!(statusRequest instanceof StatusRequestImpl)) {
+ throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED,
+ "Invalid state");
+ }
+ StatusRequestImpl request = (StatusRequestImpl) statusRequest;
+
if (request.needSignature()) {
try {
byte[] signature = sdi.wrapper.getSignParameter4().getPlainSigner().sign(
- request.getSignatureData(), request.getSignatureDataByteRange(), sdi.wrapper.getSignParameter4());
+ request.getSignatureData(), request.getSignatureDataByteRange(), sdi.wrapper.getSignParameter4(),
+ request.getStatus().getRequestedSignature());
request.setSigature(signature);
- request = this.pdfas4.process(request);
+ request = (StatusRequestImpl) this.pdfas4.process(request);
if(request.isReady()) {
at.gv.egiz.pdfas.lib.api.sign.SignResult result = this.pdfas4.finishSign(request);
sdi.wrapper.syncNewToOld();