EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Xml sign pdf file

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#9837
Posted: 04/27/2009 14:42:04
by Dmytro Bogatskyy (EldoS Corp.)

Quote
Could you please show me the way to verify the signature of a signed and time-stamped pdf document?Which SBB class will be used to do this.

Please, see Samples\PDFBlackbox\TinyProcessor demo application.
You'll need to use the following classes: TElPDFDocument, TElPDFSignature, TElPDFPublicKeySecurityHandler
#9839
Posted: 04/27/2009 21:09:18
by Thanh Nguyen Trung (Priority Standard support level)
Joined: 09/12/2008
Posts: 73

Thanks
#9869
Posted: 04/29/2009 23:20:31
by Thanh Nguyen Trung (Priority Standard support level)
Joined: 09/12/2008
Posts: 73

Hi!

Can PdfSigner generate detach signature?If it is possible, please give me a quick guide and let me know the difference between the pdf detach signature generated by pdf-signer with the detach one generated by MessageSigner (in PKCS7???).

I would like to sign files in any format and put the signature in a separate file (detach-signature, is it true?), could you please give me a suggestion of what kind of signature type I should use. I know there are several ones including: XADES, XADES-XXX, PCKS7/CMS, PDF, etc, but I don't understand them deeply to have a best choice.

Thank you
Thanh
#9870
Posted: 04/29/2009 23:32:30
by Eugene Mayevski (EldoS Corp.)

PDF format always embeds signatures. If you want to get a detached signature, use PKCS#7 signing with TElMessageSigner class.

In general, only XMLDSig and PKCS#7/CMS support detached signatures. PKCS#7 is probably more widespread.


Sincerely yours
Eugene Mayevski
#9871
Posted: 04/29/2009 23:39:55
by Thanh Nguyen Trung (Priority Standard support level)
Joined: 09/12/2008
Posts: 73

Hi Pro. Eugene Mayevski,

Thank for your explanation!

I did use MessageSigner to generate PKCS7 signature for files. Do you mean XMLDSig including XADES? Using XMLBlackbox sample I can generate detached signature with XADES options.

Thank you
Thanh
#9877
Posted: 04/30/2009 11:42:04
by Eugene Mayevski (EldoS Corp.)

I might be wrong, but XAdES doesn't mention detached signatures anywhere. XMLDSig, however, includes detached as one of signature types.


Sincerely yours
Eugene Mayevski
#9878
Posted: 04/30/2009 12:12:09
by Thanh Nguyen Trung (Priority Standard support level)
Joined: 09/12/2008
Posts: 73

Hi

Another question, I got a message "Security handle not found".

Senario:
1. Upload pdf document into server ASP.NET
2. Pass the pdf document in byte array to a wcf service function
3. Temporatorily save pdf byte array to a file.
4. Do pdf signing with the temporary file. (simulate the PDFBlackBox\ASPNET20 example)

I got error message "Security Handle not found" while doing Document.Open(stream)

Thanks
#9879
Posted: 04/30/2009 13:34:51
by Dmytro Bogatskyy (EldoS Corp.)

Quote
I got error message "Security Handle not found" while doing Document.Open(stream)

Please, attach the PDF document here or post it to the Helpdesk for investigation.

P.S. XAdES extends the XMLDSig specification (it doesn't restrict anything), so you can create detached xml signature with XAdES.
#9881
Posted: 04/30/2009 22:09:49
by Thanh Nguyen Trung (Priority Standard support level)
Joined: 09/12/2008
Posts: 73

Hi

I think there is no problem with the PDF file, using this file, I can sign by the PDFBlackBox\TinySigner example.
Below is the code, the exception come by the line of code: pdfDocument.Open(stream)

//Preparing data
/*MemoryStream stream = new MemoryStream();
stream.Write(data2Sign, 0, data2Sign.Length);
*/

string fname = Environment.TickCount.ToString() + ".pdf";
fname = HttpRuntime.AppDomainAppPath + "tmp\\" + fname;
FileStream outputStream = new FileStream(fname, FileMode.Create, FileAccess.ReadWrite);
outputStream.Write(data2Sign, 0, data2Sign.Length);
outputStream.Position = 0;

TElPDFDocument pdfDocument = new TElPDFDocument();

TElPDFPublicKeySecurityHandler publicKeyHandler =
new TElPDFPublicKeySecurityHandler();

pdfDocument.Open(outputStream);//Exception

These lines of code belong to a library function in server side under a windows communication foundation (wcf) service hosted in IIS. I use .NET 3.5 SP1.

Using memory stream, I also get the same error message "Security Handle not found"

Thanks
#9882
Posted: 05/01/2009 01:05:35
by Eugene Mayevski (EldoS Corp.)

Can you please create a test case and post it to HelpDesk together with a sample PDF file? Please ZIP all files.


Sincerely yours
Eugene Mayevski
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.

Reply

Statistics

Topic viewed 7836 times

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




|

Back to top

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

Got it!