EldoS | Feel safer!

Software components for data protection, secure storage and transfer

PDFBlackbox---Problem getting properties from invalid signatures

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
Posted: 03/01/2013 03:52:16
by Peter Lidbaum (Basic support level)
Joined: 02/22/2013
Posts: 4

Hi EldoS!

I'm evaluating your toolkit to see if we can use it to post-process the PDF documents that our in-house PDF solution produces. Any signatures in the input PDFs will become invalid after our processing---so we want to re-sign them with new certificates, but want to keep as much of the look-and-feel of the original signatures as possible.

Our input document contains invalid signatures---see the attached .jpg. Each signature contains a scanned image containing the handwritten signature and some text (I've edited out part of the text/handwriting manually in PhotoShop to obfuscate the customer data, so the black "blocks" in the image isn't really there).

The idea was/is to use your toolkit to enumerate the existing signatures, get their properties, remove the invalid signatures, then create new signatures at the same location with the same (or similar) appearance and sign these with new certificates.

However, I'm having problem getting the properties of the invalid signatures. I've written a code snippet that just asks each signature about its most basic properties:

for (int i = 0; i < Document.get_SignatureCount(); i++)
TElPDFSignature *pSig = Document.get_Signatures(i);

// Get the page no of the signature
int nPageNo = pSig->get_Page();

printf("Page: %d\n", nPageNo);

TElPDFSignatureWidgetProps* pWidgetProps = pSig->get_WidgetProps();

int nOffsX = pWidgetProps->get_OffsetX();
int nOffsY = pWidgetProps->get_OffsetY();
int nWidth = pWidgetProps->get_Width();
int nHeight = pWidgetProps->get_Height();

printf("nOffsX: %d\n", nOffsX);
printf("nOffsY: %d\n", nOffsY);
printf("nWidth: %d\n", nWidth);
printf("nHeight: %d\n", nHeight);

// Allocate a 32k vector
std::vector<uint8_t> oOut(0x7FFF);


printf("CustomAppearance: [");

for (int j = 0; j < oOut.size(); j++)
printf("%c", oOut[j]);


However, when run this code on the PDF with the invalid signatures, I get the result:

Page: 0
nOffsX: 0
nOffsY: 0
nWidth: 70
nHeight: 70
CustomAppearance: []

Page: 0
nOffsX: 0
nOffsY: 0
nWidth: 70
nHeight: 70
CustomAppearance: []

The signatures are on the second page, so the get_Page() call should return 1, and also, the x/y/w/h parameters should show something in the middle of the page, not something 70x70 pts in the lower left corner.

If I try this on a version of the same file where I have manually in Acrobat replaced the signatures with valid ones, then I get correct values for the location of the widget.

So my question is: The values I get back seems to be some "default" values---other properties of the invalid signature (such as the "Author" property of the original) are returned correctly. Do you have any idea what might be going on, or can I just forget about using the toolkit with invalid signatures?

Also, the function that I had hoped to use to preserve the appearance of the signature:


does not return any result at all, neither on invalid or valid signatures, it just resets the vector I pass to zero length.

Do you have any idea why it doesn't return anything? I understand that is probably hard without having the actual PDF data...

Exactly what should it return if it had been successful? The appearance of the signature is defined by a PDF XObject form, is it the contents of its content stream that get_CustomAppearance() will return?

And, most important, if I can get valid data back from the using the get_CustomAppearance() call, could I use this to set the appearance of another (new) signature by just passing it on to set_CustomAppearance()?

Thanks / All the best,


Posted: 03/01/2013 07:22:39
by Dmytro Bogatskyy (Team)

The question has been moved to HelpDesk for investigation.



Topic viewed 612 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!