create pdf document hash

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

sforno1960
User
Posts: 4
Joined: Sun Mar 18, 2012 4:33 pm

create pdf document hash

Post by sforno1960 »

Hi,

i am new to this forum and also to manage pdf file. I am evaluating the tracker sdk. My task is to add a digital signature in pdf, including biometric data. i have to calculate the has of a pdf document before including the signature into the pdf document. Is there a sdk function available for this ? If this function does not exists, as far i known, i need to have pdf document as a byte stream to make an SHA hash. how can i have this byte stream?

thanks in advance

s.forno
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: create pdf document hash

Post by Tracker Supp-Stefan »

Dear S. Forno,

Please take a look at the PXCp_SignDocumentXXX functions in our PDF Tools SDK (and the manual) - which should explain to yo how to place your desired signatures on the desired page(s) - and all this without any UI needed.
I believe you can achieve all you want using the SDK features, and no external document hashing will be needed.

Best,
Stefan
sforno1960
User
Posts: 4
Joined: Sun Mar 18, 2012 4:33 pm

Re: create pdf document hash

Post by sforno1960 »

dear stephan,

first of all, thanks for your fast reply.
I read documentation, but as far as i understood, the functions you refers apply a digital signature inside a PDF document, with different parameters.
I have a grafometric signature, where a user uses a tablet to make a graphical signature and tablet acquires signature biometric data. European directive requires that
biometric data should joined with a document hash taken before the signature. This data should be encrypted with a public key (to keep this data safe and unreadable except public authority). Then this encrypted data should be inserted into a PDF as a non-visible object. Only at this point the document should have a digital signature (including, if requested, the graphical image of the signature). This last operation could be done with your functions, but before that, I should arrange the biometric template. So i need to have a document hash (may be even with byte range ?) and a function to insert encrypted template into PDF as non-visible object.
Hope this can help you.

thanks

s. forno
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: create pdf document hash

Post by Tracker Supp-Stefan »

Hello S. Forno,

Thanks for the clarification. I am not a signature expert - but looking at the process you described - it seems like you will need to obtain the hash yourself - then combine that with the tablet input to prepare the signature certificate - and you can then use our Tools SDK for the rest.

Using the PDF Tools I believe that you will actually be doing the part with inserting the encrypted data as part of the PDF - and then having a visual representation of the signature is certainly optional (check the dwFlags section of the PXCp_SignDocumentW method).

Best,
Stefan
sforno1960
User
Posts: 4
Joined: Sun Mar 18, 2012 4:33 pm

Re: create pdf document hash

Post by sforno1960 »

hi stefan,

ok, your answer is clear. please could you suggest me the function for inserting a non visible object (the signature, that could be seen as a blob) into the pdf ?
can i insert some object property also ?

thanks

s. forno
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: create pdf document hash

Post by Tracker Supp-Stefan »

Hello S. Forno,

I spoke with our project leader and here is what he told me.
"This seems like an attempt to implement custom signing. I am afraid that this is not possible using our SDKs. To sign a document, you have to:
1. create the signature field, and all it's items in the PDF structure; as the value of the signature is unknown on this stage, you have to reserve some space for signature value and also values for the /ByteRange array
2. save document and during save you have to know the position in the file where that reserved space for values and /ByteRange is;
3. modify the /ByteRange array values directly in the saved file (as in any binary file, not using PDF API)
4. calculate hash of the file excluding the area where the signature value will be placed;
5. sing this hash and get signature value;
6. store this value in reserved space
Which process cannot be done using our SDKs - you never know where the reserved space is located in the file - we don't provide such information."

Hope this clarifies the situation.

Best,
Stefan
sforno1960
User
Posts: 4
Joined: Sun Mar 18, 2012 4:33 pm

Re: create pdf document hash

Post by sforno1960 »

stefan

thanks for your help. I understand what you say, but, i have the signature field already inserted into the document. my application should only fill the document according the signature field present in the document. these signature field in document have space already reserved.
what you say is that your sdk do not provide a scan of the pdf document, so it is not possible to take information about signature field and its properties, in order to perform pdf hashing and template insertion.
is this correct ?

thanks again

s. forno
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6902
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada

Re: create pdf document hash

Post by Paul - Tracker Supp »

Hi sforno1960

After consulting with our Development Team leader I'm afraid I must inform you that we do not support the features that would be required to do this.

:(
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com