aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-12-02 16:14:07 +0000
committerferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-12-02 16:14:07 +0000
commitc6cc43d237021fe27a9c264c807d00c9a711464b (patch)
tree95c8129eb27521db4a95739d638374eb8bce0a73 /src/main/java/at
parentf10184702ba6ab3e4e782343c5e16490a7388b6e (diff)
downloadpdf-as-3-c6cc43d237021fe27a9c264c807d00c9a711464b.tar.gz
pdf-as-3-c6cc43d237021fe27a9c264c807d00c9a711464b.tar.bz2
pdf-as-3-c6cc43d237021fe27a9c264c807d00c9a711464b.zip
added adobe sig attribute
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@469 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java63
1 files changed, 17 insertions, 46 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 79a7658..f62b298 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
@@ -180,7 +180,7 @@ public class BinarySignator_1_0_0 implements Signator
invisible_field_definitions.add(sfd);
}
- IncrementalUpdateInformation iui = IncrementalUpdateHelper.writeIncrementalUpdate(pdfDataSource, pdf_table, profile, pi, variable_field_definitions, all_field_definitions, invisible_field_definitions, invKZString, timeStamper);
+ IncrementalUpdateInformation iui = IncrementalUpdateHelper.writeIncrementalUpdate(pdfDataSource, pdf_table, profile, pi, variable_field_definitions, all_field_definitions, invisible_field_definitions, invKZString, timeStamper, null);
iui.invisible_field_definitions = invisible_field_definitions;
iui.invisibleKZString = invKZString;
@@ -268,54 +268,25 @@ public class BinarySignator_1_0_0 implements Signator
BinarySignature.replaceCertificate(iui);
BinarySignature.replaceTimestamp(iui);
BinarySignature.replacePlaceholders(iui);
-
+
+// dferbas: alternative sign attrib creation
+// PdfReader reader = new PdfReader(iui.signed_pdf);
+//
+// OutputStream os = dataSink.createOutputStream(PdfAS.PDF_MIME_TYPE);
+//
+// try {
+// PdfStamper stamper = PdfStamper.createSignature(reader, os, '\0', null, true);
+//
+// BinarySignature.createAdobeSigAttrib(stamper, signatorInformation, signatorInformation.getActualTablePos());
+//
+// } catch (DocumentException e) {
+// log.error("pdf error", e);
+// throw new SignatorException(ErrorCode.CANNOT_WRITE_PDF, e);
+// }
OutputStream os = dataSink.createOutputStream(PdfAS.PDF_MIME_TYPE);
os.write(iui.signed_pdf);
- os.close();
-
-
-// // dferbas write itext marker
-// PdfReader rd = new PdfReader(iui.signed_pdf);
-// FileOutputStream fout = new FileOutputStream("itextsigned.pdf");
-// try {
-// log.info("sign itext external");
-// PdfStamper stamper = PdfStamper.createSignature(rd, fout, '\0');
-// PdfSignatureAppearance sap = stamper.getSignatureAppearance();
-// Certificate[] certs = new Certificate[] { iui.signed_signature_object.x509Certificate };
-// sap.setCrypto(null, certs, null, PdfSignatureAppearance.SELF_SIGNED);
-// sap.setReason("pdf-as signature");
-// sap.setLocation("dahoam");
-// //sap.setExternalDigest(digest, RSAdata, digestEncryptionAlgorithm);
-// byte[] sigVal = Base64.decodeBase64(iui.signed_signature_object.signatureValue.getBytes());
-// //byte[] sigVal = iui.signed_signature_object.signatureValue.getBytes();
-// sap.setExternalDigest(sigVal, null, "RSA");
-//// int csize = 40000;
-//// HashMap exc = new HashMap();
-//// exc.put(PdfName.CONTENTS, new Integer(csize * 2 + 2));
-// sap.preClose(); // *2+2
-//
-//// sap.preClose(new HashMap() {{ put(PdfName.CONTENTS, new Integer(4000)); }});
-//
-// PdfPKCS7 sig = sap.getSigStandard().getSigner();
-// sig.setExternalDigest(sigVal, null, "RSA");
-//
-// log.info(new PdfString(sigVal).setHexWriting(true)+ "END");
-//
-// PdfDictionary dic = new PdfDictionary();
-// dic.put(PdfName.CONTENTS, new PdfString(sigVal).setHexWriting(true));
-// sap.close(dic);
-//
-// //stamper.close();
-//
-//
-// } catch (DocumentException e) {
-// log.error(e, e);
-// throw new RuntimeException(e);
-// }
-
- //SignResult sign_result = new SignResult(PdfAS.PDF_MIME_TYPE, iui.signed_pdf);
- //return sign_result;
+ os.close();
}
catch (PDFDocumentException e)
{