Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-3628

BadPaddingException on a valid document

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.3
    • Fix Version/s: None
    • Component/s: Crypto, Parsing
    • Labels:
      None
    • Environment:
      Windows 7 x64, JVM 1.8.0_101

      Description

      On the attached document, which opens fine with Adobe Reader, the PDDocument.load() throws an error:

      java.io.IOException: javax.crypto.BadPaddingException: Given final block not properly padded
      at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptDataAESother(SecurityHandler.java:296)
      at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:153)
      at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptStream(SecurityHandler.java:454)
      at org.apache.pdfbox.pdfparser.COSParser.parseFileObject(COSParser.java:784)
      at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:741)
      at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:672)
      at org.apache.pdfbox.pdfparser.COSParser.parseDictObjects(COSParser.java:632)
      at org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:217)
      at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:252)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:966)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:922)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:870)
      Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
      at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:966)
      at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
      at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436)
      at javax.crypto.Cipher.doFinal(Cipher.java:2048)
      at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptDataAESother(SecurityHandler.java:276)
      ... 12 more

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sevaa Seva Alekseyev
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: