Is this byte array a password-protected PDF document?

There are several possibilities for password-protecting PDF, some defined by Adobe ("standard") and as part of the standard it is possible to have so-called "alternate security handlers".

Anyway all can be detected basically by checking for the respective "dictionaries" as described on pages 115 - 136 of the PDF spec - see http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf


Docotic.Pdf library can be used to perform such check.

The library provides group of methods that can be used to check if bytes, stream or file contain a password protected PDF document.

Please take a look at the sample that shows how to check if an existing PDF document is password protected.

Disclaimer: I work for the company.