Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > Sample Code
  New Posts New Posts RSS Feed - Signing a password protected document
  FAQ FAQ  Forum Search   Register Register  Login Login

Signing a password protected document

 Post Reply Post Reply
Author
Message
Bigun View Drop Down
Beginner
Beginner


Joined: 23 Jul 19
Location: Irun
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bigun Quote  Post ReplyReply Direct Link To This Post Topic: Signing a password protected document
    Posted: 24 Jul 19 at 12:25PM
Hi all,
I've been required to digitally sign an already password protected document with no success.
I'm using QuickPdf v11.13. So far I can digitally sign unprotected PDFs, with or without images, with no problem. Basically:
- NewSignProcessFromFile(...)
- SetSignProcessPFXFromFile(...)
- SetSignProcessFieldBounds(...)
- SetSignProcessFieldImageFromFile(...)
- EndSignProcessToFile(SignedPdf)  // SignedPdf= new signed PDF
res= GetSignProcessResult(...).  // OK

But the same process with a password protected PDF does not sign the resulting PDF. This protected PDF already has an empty signature field and has no constraints filling fields, signing...

The original protected PDF (password; owner) is
https://we.tl/t-x0JuwBxfqQ
The resulting not signed PDF is:
https://we.tl/t-uh06rFQf1r

Can anyone guide me or give me any hint?
Thank you very much

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jul 19 at 8:33PM
Hi Bigun,

did you read the description regarding NewSignProcessFromFile?
https://www.debenu.com/docs/pdf_library_reference/NewSignProcessFromFile.php
There you can read:
"...Creates a new digital signature process using a file as the source document...".
There is a password as parameter ;-)
If the password is protected the original owner wanted to protect it ;-)
If it's only the main password you can do it this way:
// ...
      QP.LoadFromFile(FileName, '');
      If QP.EncryptionStatus > 0 Then
        QP.Decrypt;
// ...
then you can begin with your signing process.

Cheers and welcome here,
Ingo


Cheers,
Ingo

Back to Top
Bigun View Drop Down
Beginner
Beginner


Joined: 23 Jul 19
Location: Irun
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bigun Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jul 19 at 8:49AM
Thank you for your answer Ingo, but I'm afraid I'm already starting the signing process using it:

int SignProcessID= QP->NewSignProcessFromFile(sSourcePdf, sOwnerPassword);
...

If I decrypt SourcePdf as you suggest, the signature process goes well but I'm not able to Encrypt the resulting signed PDF, so I get a signed unprotected PDF:

int Permisos= QP->EncodePermissions(1, 0, 0, 0, 1, 1, 0, 1);
int iRes= QP->Encrypt(sPassOwner, "", Strength, Permisos);
QP->SetSignProcessPFXFromFile(SignProcessID, PFXFileName, PFXPassword);
...
QP->EndSignProcessToFile(SignProcessID, sOutput);  // <== should be signed and password protected
 
On the other hand, if I don't decrypt it, the resulting file, though protected, does not get signed.

I'll keep trying. Thanks for your help!!
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jul 19 at 8:52PM
Hi Bigun,

here's a kb-document from Debenu:
https://www.debenu.com/kb/add-visual-digital-signature-to-a-pdf-programmatically/

With this link you'll find interesting hints from Rowan:
http://www.quickpdf.org/forum/visible-digital-signature_topic2563.html

A quick read through the content lt me think that signing doesn't need a password?
If you simply rewrite the pdf the signature is broken and all readers are telling that the signature in the loaded pdf was broken...

Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store