How do I find if the user supplied password is 'open'/'user' or 'permission'/'owner'?

Q: How do I find if the user supplied password is 'open'/'user' or
'permission'/'owner'?
-------
A: If
pdfdoc.GetSecurityHandler().GetPermission(SecurityHandler.Permission.e_owner)
returns true, the user supplied data is 'permission'/'owner' password
(i.e. the user has full access to the document). Otherwise the user
supplied data is 'open'/'user' password (and you may want to impose
certain restrictions depending on the current state of other
permission flags).