aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-legacy/src
diff options
context:
space:
mode:
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();