Need to detect Security on PDF

A forum for questions or concerns related to the PDF-XChange Core API SDK

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

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Need to detect Security on PDF

Post by whoit » Fri May 11, 2018 8:11 pm

Hi -

We have implemented this code to check for Security,
and it works on most PDFs except the one I have provided
via email.

Code: Select all

// Checking whether the document has any security
                   long llNameAtom;
                   llNameAtom = loDoc.GetSecurityHandlerType(false);

                   if (llNameAtom == 0)
                   {
                       // No security
                       lbResult = false;
                   }
                   else
                   {
                       // document has some security
                       lbResult = true;
                   }
Can you please tell me why the Security is not detected?

Thanks.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13329
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Need to detect Security on PDF

Post by Tracker Supp-Stefan » Mon May 14, 2018 9:54 am

Hello whoit,

Did you send that e-mail to one of my colleagues in the dev team directly or e.g. to our support@ e-mail?
I can't seem to find the sample file you sent to us, but could it be e.g. secured with some third party handler like FileOpen ?

Regards,
Stefan

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit » Mon May 14, 2018 12:50 pm

It was sent to the support email address with this subject: File to accompany Forum post
and a link to the post in the body.

As for the security used - I'm not certain as it is a client file.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13329
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Need to detect Security on PDF

Post by Tracker Supp-Stefan » Mon May 14, 2018 3:26 pm

Thanks Whoit,

Trying to locate the e-mail with the file now!
We will check the security used in that shortly and will post back here with an update!

Regards,
Stefan

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit » Mon May 14, 2018 3:50 pm

OK, if you cannot find it shortly, let me know and I can resend it to whatever email address you like.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13329
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Need to detect Security on PDF

Post by Tracker Supp-Stefan » Mon May 14, 2018 4:03 pm

Hello whoit,

Found the file - it has been forwarded to a colleague in the dev team.
It is an XFA form - and as we do not yet support those at 100% - when such a fom exists in a file - we might prevent some operations on the file even if there is no specific security restriction applied to the same. I will await Sasha's feedback as well, but I suspect this is the main reason why you don't have full permissions to manipulate that file.

Regards,
Stefan

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit » Mon May 14, 2018 4:12 pm

Hi Stefan -

That's interesting info though I'm not concerned about manipulating the file.

I'm mainly concerned that the API and the code I posted does not recognize the file as protected via Certifcate.

User avatar
Sasha - Tracker Dev Team
User
Posts: 4076
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team » Tue May 15, 2018 7:29 am

Hello Wayne,

The document can be secured but it won't have a security handler type (like you use it) in these cases:
1) PDF/A
2) XFA
3) Digital Signatures
The best way to know whether the document is secured is to use this method:
https://sdkhelp.tracker-software.com/vi ... Permission
With Perm_ObjDoc and Perm_OperSecure flags. If the resulting PXC_PermStatus will be Denied then the document is secured. Note, that if the Owner's password was entered when opening the document, then the PXC_PermStatus will be Granted not Denied.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit » Tue May 15, 2018 12:26 pm

Hi Alex -

Yes, that seems like a better approach - we will try it and let you know how it works for us.

Thanks! :mrgreen:

User avatar
Sasha - Tracker Dev Team
User
Posts: 4076
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team » Tue May 15, 2018 12:37 pm

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit » Tue May 29, 2018 3:01 pm

Hi Alex -

We are trying to determine which Permissions are affecting our ability to work with
any given PDF.
Can you tell which PDF document/specification you are using when implementing:

RequestObject
RequestOper

I'm trying to find a reference to which Objects are controlled by which Operations
For example, which of the 34 Operations affect Annotations? Printing? Copying?, etc.

Also, where is the enum PXC_SecurityPermissions used?
I can't find anywhere in the Documentaiton where this enum is referenced except the definition.

Thanks,
Wayne

User avatar
Sasha - Tracker Dev Team
User
Posts: 4076
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team » Wed May 30, 2018 1:03 pm

Hello Wayne,

The RequestObject/RequestOper flags will need to be documented for each of the operations separately and sadly there is no documentation about them for now.
The real PDF security is being set with this method:
https://sdkhelp.tracker-software.com/vi ... Encryption
And that's where are the PXC_SecurityPermissions flags are used.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit » Wed May 30, 2018 1:25 pm

Hi Alex -

The RequestObject/RequestOper flags are an issue for us - we are finding client files that have a variety of security enabled,
and we need to be able to determine which Operations prevent us from working with the document.

Without documentation, how are we to determine which of the 34 Operations for each of the 10 Objects are affecting us?

User avatar
Sasha - Tracker Dev Team
User
Posts: 4076
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team » Thu May 31, 2018 10:22 am

Hello Wayne,

In your case, you can cycle through all of the operations/permissions in the document and make yourself a list of the restrictions - that would be the best case. I've though from the start that you were talking about the Editor SDK level operations.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit » Thu May 31, 2018 12:56 pm

Hi Alex -

Well, that's unfortunate...I thought you'd have a reference document of some kind (like for PDF/XFA) that details the
Objects and Operations.

As for the reference to EditorSDK - We don't use it - never have. I think you'll notice all my posts are in CoreAPI forum
(except for a few in OCR).

Thanks.

User avatar
Sasha - Tracker Dev Team
User
Posts: 4076
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team » Sat Jun 02, 2018 6:31 am

Hello Wayne,

When we were implementing the Object/Oper logic we took the Acrobat SDK Specification into an account - you can check it out.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit » Mon Jun 04, 2018 2:36 pm

Hi Alex -
Can you tell me which version of the SDK ?

https://www.adobe.com/devnet/acrobat/downloads.html

-Wayne

User avatar
Sasha - Tracker Dev Team
User
Posts: 4076
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team » Mon Jun 04, 2018 2:41 pm

Hello Wayne,

Well I can't tell you what version was the newest during the time of the implementation of that logic. You can try the latest version - I think it should have the most complete and updated data.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit » Mon Jun 04, 2018 2:43 pm

OK, thanks...

User avatar
Sasha - Tracker Dev Team
User
Posts: 4076
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team » Mon Jun 04, 2018 2:46 pm

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply