EldoS | Feel safer!

Software components for data protection, secure storage and transfer

2 digital signatures instead of only 1

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
Posted: 04/29/2014 09:21:38
by glinttgs sousa (Basic support level)
Joined: 02/27/2014
Posts: 51

Hi Eldos,

I'm developing a single digital signature process in PDF and XML, so I'm using your PDFBlackBox and XMLBlackBox. I'm using your newest Java Samples.

When I complete a signature, my documents are signed twice, with the same certificate. I don't understand why. My XML and PDF files are signed two times, but if I use your OfficeBlackBox, the document is only signed once, like I want.

For example, here is my PDFSigning code:

public boolean PDFSigning(String document, String path, String password)

          LoadAPILicenseKey(); //here I just set the Eldos License Key

          System.out.println("API key loaded!");
          TElPDFDocument doc = new TElPDFDocument();

          TElStream stream = new TElFileStream(document, "rw", true);

          catch (Exception e)
              System.out.println("Invalid PDF file");
              return false;

          System.out.println("Document opened");
          int indexNewlyAddedSignature = doc.AddSignature();

          TElPDFSignature pdfSignature = doc.GetSignatureEntry(indexNewlyAddedSignature);

          System.out.println("Signature getting");
          TElPDFPublicKeySecurityHandler pdfPKSecurityHandler = new TElPDFPublicKeySecurityHandler();

          // enum TSBPDFPublicKeySignatureType { pstX509RSASHA1 = 0, pstPKCS7SHA1 = 1 };
          System.out.println("setting pkcs7sha1");

          pdfPKSecurityHandler.SetCertStorage(LoadCertificateDataPDF(path, password)); //the certificate is well loaded, I'm using a local certificate.pfx
          System.out.println("certificate setted!");
          System.out.println("setted custom name to PPKLite!");
          //"Adobe.PPKLite" causes Adobe tools to look for certificates in internal storage. "Adobe.PPKMS" causes Adobe tools to look for certificates in Windows Certificate storage.

     //     pdfSignature.Handler = pdfPKSecurityHandler;
          Date date = new Date();
          System.out.println("Setted signing time");
        /*TElPDFSignatureWidgetProps pdfSignatureWidgetProps = new TElPDFSignatureWidgetProps(); //to control and customize signature appearance
          pdfSignature.WidgetProps = */
          short sigType = 1;
          System.out.println("Setted signature type to stDocument");

           *  stDocument = 1          stDocument stDocument = 0               Document signature
              stMDP = 2 stMDP         stMDP = 1                               Certification (MDP signature) --> outdated
              stUsageRights = 3       stUsageRights stUsageRights = 2         Usage rights signature
              stObject = 4            stObject stObject = 3                   Object signature
              stUnknown = 255         stUnknown stUnknown = 4                 Unknown type

          System.out.println("Setted to invisible");
              doc.Close(true); //true to save in the file; false not to
              System.out.println("Document saved with signature");
              System.out.println("Security handler freed");
          catch (Exception e)
              return false;

         // streamOut.close();

          return true;

I'm working with a MAC OS and as I said, with this code, the document is signed twice, and the timestamps are different. I don't understand why, because I only call this method once in my code.

Can you help me? Has this happened before?

My best regards and thank you for your attention,
Posted: 04/29/2014 09:24:28
by Eugene Mayevski (Team)

Thank you for the report.

Does the sample project expose the same issue? If no, how is your code different from the sample?

On a side note, if you purchased a license, please link the license ticket to your user account. The ticket itself and the procedure of its use are specified in the registration e-mail that was sent to you upon license purchase. If you don't have the license ticket, please contact the person from which you have obtained the license key (the one in your source code) for a license ticket.

NOTE: please don't post license keys and license tickets to the forum. If you need to clarify something about your license, please use HelpDesk ( http://www.eldos.com/helpdesk/ ).

Sincerely yours
Eugene Mayevski



Topic viewed 448 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!