title: How to check if a PDF is Password Protected or not
body: <p>I am trying to use iText's PdfReader to check if a given PDF file is password protected or not, but am getting this exception:</p>
  
  <blockquote>
    <p>Exception in thread "Main Thread" java.lang.NoClassDefFoundError:org/bouncycastle/asn1/ASN1OctetString      </p>
  </blockquote>
  
  <p>But when testing the same code against a non-password protected file it runs fine. Here is the complete code:</p>
  
  <pre><code>try {
      PdfReader pdf = new PdfReader("C:\\abc.pdf");
  } catch (IOException e) {
      e.printStackTrace();
  }
  </code></pre>