I set the password of user as 1, and the password of owner as 2.
But when i init StdSecurityHandler using
'doc.InitStdSecurityHandler(string password)' method,
the StdSecurityHandler return same value of owner's password and
user's password .
If i inited the StdSecurityHandler by user password '1', _userpassword
and _masterpassword are all '1'
if i tried by password '2', _userpassword and _masterpassword are all
It is problem when i try to change master's password, so i reseted
handler the user's password changed '2'.
What's wrong with me?
i used this code get the password or user's and owner's.
SecurityHandler secHdl = _pdfDoc.GetSecurityHandler();
pdftron.SDF.StdSecurityHandler s = new
_userpassword = s.GetUserPassword();
_masterpassword = s.GetMasterPassword();
If the document is secured with 'open' password you can't check the
permissions or use the document until one of the passwords is
provided. This is a feature of PDF specification (if it was the other
way, it would be very easy to break document security).
Password validation is performed within
pdfdoc.InitStdSecurityHandler() method. If the 'user' (a.k.a. 'open')
password does not allow certain permissions of the document, you could
request a 'master' (a.k.a. owner) password from the user (e.g. in
order to allow modifications to security settings). After obtaining
the mater password from the user you can call InitStdSecurityHandler()
again with the master password.
So if you need to check if the user has 'owner' access to the document
you can use the following line:
The same line can be used to determine whether a given password is
'user' or 'owner'. If the user provided the user password (i.e.
sec_hdlr.GetPermission(SecurityHandler.Permission.e_owner) is false)
GetMasterPassword() does not apply.