Need to detect Security on PDF

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

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, 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: 269
Joined: Tue Jul 07, 2015 3:30 pm

Need to detect Security on PDF

Post by whoit »

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: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Need to detect Security on PDF

Post by Tracker Supp-Stefan »

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: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit »

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: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Need to detect Security on PDF

Post by Tracker Supp-Stefan »

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: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit »

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: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Need to detect Security on PDF

Post by Tracker Supp-Stefan »

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: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit »

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.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team »

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.pdf-xchange.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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit »

Hi Alex -

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

Thanks! :mrgreen:
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit »

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
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team »

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.pdf-xchange.com/vi ... Encryption
And that's where are the PXC_SecurityPermissions flags are used.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit »

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?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team »

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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit »

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.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team »

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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit »

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

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

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

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team »

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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Need to detect Security on PDF

Post by whoit »

OK, thanks...
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Need to detect Security on PDF

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply