Signature on a PDF containing attachments - pdf

If I apply a digital signature on a PDF file which contains another PDF files attached on it, does the signature apply to the whole document including attachments, or only to the "main" PDF ?
The goal is to detect any modification on any part of the document itself and all the files attached.

The signature on the parent document will calculate it's checksum based on all the bytes in the file. If any of the attachments are modified and saved back to the parent file, you will be able to detect that the entire package has changed but unless you also sign the child documents, you may not be able to tell which of the children was changed.
You may also want to invest in a certificate that is already on the Adobe Approved Trust List so that the document will appear valid when first opened and the use won't need to install your specific certificate. You can read more about this at the URL below.
http://helpx.adobe.com/acrobat/kb/approved-trust-list2.html

Assume, you have a PDF with attached files. From the point of view of PDF structure and PDF syntax, these attachments are represented by embedding some "standard" PDF objects including "streams".
When you digitally sign this PDF file, the signature is valid for the complete PDF file, consisting of all PDF objects (thusly including the attachments).
Should someone extract a copy of the attached files, modify them and then re-attach these, it will change the contents of the PDF. Hence the signature will become invalid by this change, which leads to the detection of the modification.
What you cannot detect:
if a copy of the attachment has been extracted (leaving the original PDF un-modified)

Related

Can you embed a separate pdf into Indesign and open it after exporting to PDF?

I would like to ask the following if possible. We have a client that wants a separate pdf document, embedded in a main pdf document and opens when you click it. Like the function in MS Word where you can attach another Word document inside a Word document (Word-ception, lol) and you can still open it.
I've tried it in Acrobat Pro with the Attachment and Link tools. Another option was to put the link document in an ftp server for accessibility. but our client really wants this functionality. Is this possible in Indesign?
Thank you!
Using Word as your example vehicle there are several ways to link 2 documents.
One is an appendix to the other, in PDF terms is a merge or binding but its one flowing document with separate sequential sections/chapters.
Another way is to link to an external file, in PDF terms a hyperlink to a relative second file, which can be locally folder relative or a web absolute reference. You have tried that.
In Word we can add objects internally with icons, in PDF that can be an annotation comment attachment to save externally and action accordingly. You also seem to discount that approach.
Finally PDF offers an Adobe Specific Structure where multiple PDFs attachments can be imbedded in an overall PDF wrapper. These are called Portfolios and not! to be confused with their portfolio service
They are unpopular since in a browser without Adobe Reader they should only offer the cover page.
Whilst in securer offline readers the files may well be shown as attachments that you need to save or independently open to view them.
Only some non Acrobat viewers may view them as a collection. And in the past that required runing insecure SWFlash, But I understand that has changed ?
Here is how the 3 internal PDF files seen above were shown in older Acrobat 9.
Possibly the best experience is using Foxit Reader

Page Templates with Form XObject in PDF

I'm writing a PDF generation library and wanted to add the the ability to use other PDFs as templates. The specification notes a TemplateInstantiatedproperty on pages with the alias of the template object should be all that is needed.
Here is a gist of the pdf content:
https://gist.github.com/tyre/89c12f8203181f078001
The template itself is stored in object 16 and the page in object 19.
qpdf --check reports the PDF as invalid:
WARNING: tmp/alpaca.pdf: file is damaged
WARNING: tmp/alpaca.pdf (file position 32089): xref not found
WARNING: tmp/alpaca.pdf: Attempting to reconstruct cross-reference table
checking tmp/alpaca.pdf
PDF Version: 1.7
File is not encrypted
File is not linearized
I'm afraid your PDF document is completely and utterly broken and that you have misunderstood a number of key concepts. You cannot simply incorporate a complete PDF file into another PDF file in the way you have done and expect that to work.
The template system you are referring to is intended to include "hidden" pages - not referenced in the pages tree in the PDF file - in the context of an interactive form document (or interactive document in general). That doesn't sound like what you are intending to do. And these pages need to be valid PDF pages. You can in other words not just include the original PDF document verbatim and expect the PDF reader to sort things out; you need to insert a syntactically correct PDF page object.
What you want to do is take the content of a document and apply that as a background to a document. This most commonly is done using XObjects. Pseudo-code for this could be:
Open the original PDF document
Open the "template" document
Read the template document and copy all elements from the template page into a newly created XObject in the original PDF document.
Modify the page contents of the pages in the original PDF document to paint the new XObject at the beginning of the page description of the existing pages.
It's important to note that again, you're not supposed to simply insert the template document into the stream for the newly created XObject. You will have to create a valid XObject that contains a properly formed resources dictionary referencing all resources needed by your XObject, and that contains the content stream from your template document.
As already indicated in comments, the PDF presented by the OP is structurally defect, the cross reference table position and entries are wrong. Furthermore the transition from one PDF revision to a next update looks questionable. Essentially, therefore, the OP will have to provide a sample PDF which is at least syntactically correct.
That been said, though, the OP indicated he was
writing a PDF generation library and wanted to add the the ability to use other PDFs as templates. The specification notes a TemplateInstantiatedproperty on pages with the alias of the template object should be all that is needed.
The Named Pages mechanism is not meant for something like that. Its main current use (if it is used at all) is in the context of spawning page templates by Acroform actions.
For using pages from other PDFs, one can simply copy them (and the referenced other objects) from the source PDF if they are to be used as separate pages as is; and if multiple templates are to be put onto a single target page, one can wrap the copied sources into form xobjects and include them in the target page.

How to read the value of fields in signed PDF using PDF Box API

Once after completion of digital signature for PDF using DocuSign, How to read value of the fields in PDF using field ID/Name (using PDF Box API)? I am not able get the field ids of Digitally Signed PDF.
The sample PDF showed that the fields in PDF are not PDF form fields after all, neither Acrofornm nor XFA, they merely are texts with some lines around them. (They may once have been PDF form fields which were flattened, or they may never have been PDF form fields to start with.)
Thus, your only option left is text extraction. PDFBox has a quite elaborate text extraction engine. Have a look at PDFTextStripper. You can try and use this class as is, looking in the extracted string for the field labels and extract the following text until the end-of-line; or if you have the time, you can try to make use of the internal PDF structure where the field contents are in a separate Xobject.

Enabling select and copy of text content in PDF

What can prevent PDF-1.4 document's content from being selectable and copyable?
I'm generating PDF-1.4 documents using TTF fonts, which are successfully embedded in it (see screenshot below).
Yet I can't select and copy the text from the document. I have studied the PDF-1.4 spec and found only one mention of copy-protecting the document, which has a prerequisite of first encrypting it. And I don't encrypt the document.
So, ideally, I'd like to discover an exhaustive list of reasons, that can prevent the PDF text from being copied, and ways to control that.
There is only one reason, you are embedding your fonts partially. The information you are storing there is the minimum required for drawing the glyphs, but it is not enough for allowing text extraction. For example, in Acrobat Professional, optimizing a file for reducing file size will have this effect, since everything that is not strictly required for presenting the content will be discarded.

Append PDF to a Signed PDF

I need to append a pdf file to a digital signed pdf file, keeping valid the signature ...maybe using revision? ...using iTextSharp? How can I do it?
Please help me with some sample.
You can use Increment Update to do that, as long as the original signature allows you.
Take look at the document:
http://learn.adobe.com/wiki/download/attachments/52658564/Acrobat_DigitalSignatures_in_PDF.pdf?version=1&modificationDate=1269905473000
on Page 8 you will find what you want.
You can't as that invalidates the whole point of digital signatures, namely to detect when something exactly as you describe occurs and therefore ensure the validity of the original document. To do as you want, you will need to add the extra PDF to the unsigned original PDF and then resign the new conglomerate PDF.