title: pdfbox: trying to decrypt PDF
body: <p>Following <a href="https://stackoverflow.com/questions/14700241/remove-encryption-from-pdf-with-pdfbox-like-qpdf">this answer</a> I'm trying to decrypt a pdf-document with pdfbox:</p>
  
  <pre><code>PDDocument pd = PDDocument.load(path);
  if(pd.isEncrypted()){
      try {
          pd.decrypt("");
          pd.setAllSecurityToBeRemoved(true);
      } catch (Exception e) {
          throw new Exception("The document is encrypted, and we can't decrypt it.");
      }
  </code></pre>
  
  <p>This leads to</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
  at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1601)
  at org.apache.pdfbox.pdmodel.PDDocument.decrypt(PDDocument.java:948)
  ...
  Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
  ...
  </code></pre>
  
  <p>The path is correct, so I don't know what's going on.
  Furthermore, if I have a look at the PDDocument.decrypt(String pw) method, I find this:
  <em>This will decrypt a document. This method is provided for compatibility reasons only. User should use the new security layer instead and the openProtection method especially.</em></p>
  
  <p>What does it mean? Could someone give an example how to decrypt a pdf-document correctly with pdfbox?</p>