aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
index 73d4866..395ae0e 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
@@ -38,7 +38,6 @@ import at.knowcenter.wag.egov.egiz.PdfAS;
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
-import at.knowcenter.wag.egov.egiz.exceptions.SignatureException;
import at.knowcenter.wag.egov.egiz.framework.SignatorFactory;
import at.knowcenter.wag.egov.egiz.pdf.BinarySignature;
import at.knowcenter.wag.egov.egiz.pdf.IncrementalUpdateInformation;
@@ -129,9 +128,30 @@ public class BinarySignator_1_0_0 implements Signator
}
}
- IncrementalUpdateInformation iui = IncrementalUpdateHelper.writeIncrementalUpdate(pdfDataSource, pdf_table, pi, variable_field_definitions, all_field_definitions);
+ List all_invisible_field_definitions = signature_object.getSignatureTypeDefinition().getInvisibleFieldDefinitions();
+ List invisible_field_definitions = new ArrayList();
+ boolean isKZInvisible = false;
+ String invKZString = null;
+ for (int i = 0; i < all_invisible_field_definitions.size(); i++)
+ {
+ SignatureFieldDefinition sfd = (SignatureFieldDefinition) all_invisible_field_definitions.get(i);
+ if (sfd.field_name.equals(SignatureTypes.SIG_KZ))
+ {
+ isKZInvisible = true;
+ invKZString = signature_object.getKZ().toString();
+ continue;
+ }
+ if (sfd.field_name.equals(SignatureTypes.SIG_ID) && has_SIG_ID == false)
+ {
+ continue;
+ }
+ invisible_field_definitions.add(sfd);
+ }
+
+ IncrementalUpdateInformation iui = IncrementalUpdateHelper.writeIncrementalUpdate(pdfDataSource, pdf_table, profile, pi, variable_field_definitions, all_field_definitions, invisible_field_definitions, invKZString);
- iui.signProfile = profile;
+ iui.invisible_field_definitions = invisible_field_definitions;
+ iui.invisibleKZString = invKZString;
String temp_string = iui.temp_ir_number + " " + iui.temp_ir_generation + " obj"; //$NON-NLS-1$//$NON-NLS-2$
byte[] temp_bytes = temp_string.getBytes("US-ASCII"); //$NON-NLS-1$
@@ -154,18 +174,21 @@ public class BinarySignator_1_0_0 implements Signator
}
}
// update KZ list indices:
- it = iui.kz_list.iterator();
- while (it.hasNext())
+ if (!isKZInvisible)
{
- StringInfo si = (StringInfo) it.next();
- si.string_start += iui.content_stream_start;
+ it = iui.kz_list.iterator();
+ while (it.hasNext())
+ {
+ StringInfo si = (StringInfo) it.next();
+ si.string_start += iui.content_stream_start;
+ }
}
BinarySignature.markByteRanges(iui);
// byte [] old_signed_pdf = iui.signed_pdf;
iui.signed_pdf = BinarySignature.prepareDataToSign(iui.signed_pdf, iui.byte_ranges);
-
+
BinarySignatorInformation bsi = compressIUI(iui);
return bsi;