Detect if user entered Owner vs. User password?

If you are a C/C++/C# developer and have any questions about using our products from your application here is the place to post them.
Post Reply
beandog
Posts: 33
Joined: Wed Dec 14 2005

Detect if user entered Owner vs. User password?

Post by beandog » Fri Feb 17 2006

I have a document that's encrypted with both user and owner passwords. Regardless of if I open the document with User or Owner password, the Document properties for OwnerPassword, UserPassword, and Permissions are all the same. OwnerPassword and UserPassword both get set to the password I used to open the document.

How can I tell which password the user has entered?



Ben Dilts

Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan » Tue Feb 21 2006

I am not sure i really get your question.

You can read the text entered by the user and compare it to your OwnerPassword and UserPassowrd to know which password has been done.

Hope this help.

beandog
Posts: 33
Joined: Wed Dec 14 2005

Let me explain

Post by beandog » Tue Feb 21 2006

Let me explain. I created a document with 128-bit encryption. The user password is "user" and the owner password is "owner". Now I close the document. I open it again, and I am prompted for a password. I type in "user". Now, in the PDF control, both the UserPassword and OwnerPassword properties on the document are set to "user".

That is, when a document is opened using a password, both the UserPassword and the OwnerPassword are set to whatever was given by the user when opening the document, NOT what was set when the document was encrypted.

So I need a way to tell what the current user actually has permissions to do on the document.

Devteam
Posts: 115
Joined: Fri Oct 14 2005
Location: Montreal
Contact:

Re: Detect if user entered Owner vs. User password?

Post by Devteam » Tue Apr 21 2009

The control can only check if a given password is valid, it cannot read the passwords from the document. For e.g. if the user supplies one of the two passwords, the control can check if it is valid and internally sets a flag to whether the password is the owner or user passowrd, but it cannot read the other password. This is why both attributes are set to the same value.

You can check if the user is allowed to print or modify a document by using the UpdateCommandTool call. You can check the online documentation for this call by visiting: http://www.amyuni.com/WebHelp/Developer ... #index.htm.

If you need more than these 2 basic checks, you can log a feature request on the forum or by emailing us.

Amyuni Development Team

Post Reply