Thanks for your inquiry. You may use PdfFileInfo class to check whether PDF file is Password protected. Please check following code snippet for the purpose.
PdfFileInfo pdfFileInfo = new PdfFileInfo( “input.pdf”);
if (pdfFileInfo.HasOpenPassword || pdfFileInfo.HasEditPassword)
Console.WriteLine(“The given PDF file is password protected.”);
if (pdfFileInfo.IsPdfFile)
Console.WriteLine(“The given PDF file is valid.”);
if (pdfFileInfo.HasCollection)
Console.WriteLine(“The given PDF file is Portfolio PDF.”);
Please feel free to contact us for any further assistance.