How do I retrieve the master ('permission') and 'open' passwords from a PDF document?

Q:

Is there any pdftron API to retrieve the master ('permission') and
'open' passwords from a PDF document?
------

A:

pdftron.SDF.StdSecurityHandler contains the following methods that can
be used to obtain both 'permission' and 'open' passwords:

GetUserPassword()
GetMasterPassword()

For more information, please see: (http://www.pdftron.com/net/html/
classpdftron_1_1SDF_1_1StdSecurityHandler.html#f7f6ebef09366e8e035354af16915e52).

These methods return password stored in a byte array using
PDFDocEncoding which is very similar to WinAnsiiEncoding (PDF
passwords are not necessarily Unicode encoded).