From 88336a5b740b8a4f722437b3be32b9360d170fc9 Mon Sep 17 00:00:00 2001 From: wprinz Date: Fri, 30 May 2008 10:02:49 +0000 Subject: CR Unsichtbare Felder git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@269 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../impl/signator/binary/BinarySignator_1_0_0.java | 39 +++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/gv/egiz') 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; -- cgit v1.2.3