Welcome Guest Search | Active Topics | Sign In | Register

"last block incomplete in decryption" exception opening PDF Options
Walden
Posted: Tuesday, May 7, 2019 2:00:58 PM
Rank: Member
Groups: Member

Joined: 3/18/2014
Posts: 15
Using the latest EO on nuget (19.1.25) I get a "last block incomplete in decryption" exception trying to open a (specific) PDF. It happens w/EO 19.0.69 as well, can't speak to other versions.

Sample code and exception are below.

The PDF is not password protected, but it is signed. I can share the PDF, but not over open forums.

Code: C#
using System;

static class Program
{
	static void Main()
	{
		var p = new EO.Pdf.PdfDocument(@"E:\tmp\BadPDF.pdf");
	}
}


Code: C#
EO.Internal.fp
  HResult=0x80131500
  Message=last block incomplete in decryption
  Source=EO.Base
  StackTrace:
   at EO.Internal.ap7.a(Byte[] A_0, Int32 A_1)
   at EO.Pdf.PdfDocumentSecurity.a.a(Byte[] A_0, Byte[] A_1, Byte[] A_2, Boolean A_3, Boolean A_4)
   at EO.Pdf.PdfDocumentSecurity.a.a(Stream A_0, Byte[] A_1, Stream A_2, Boolean A_3)
   at EO.Pdf.PdfDocumentSecurity.a.a(Int64 A_0, Int64 A_1, Stream A_2, Stream A_3, Boolean A_4)
   at EO.Pdf.PdfDocumentSecurity.a(Int64 A_0, Int64 A_1, Stream A_2, Stream A_3, Boolean A_4)
   at EO.Internal.vx.a(PdfDocumentSecurity A_0, Int32 A_1, Int32 A_2)
   at EO.Internal.akt.a.a(a5c A_0)
   at EO.Internal.al.c(a5c A_0)
   at EO.Internal.al.a(a5c A_0)
   at EO.Internal.al.a(IEnumerable`1 A_0)
   at EO.Internal.akt.a(PdfDocumentSecurity A_0)
   at EO.Internal.akt.a(Boolean A_0, Boolean A_1, PdfDocumentSecurity A_2)
   at EO.Internal.gh.a(Stream A_0, Boolean A_1, Boolean A_2)
   at EO.Internal.gh.a(String A_0)
   at EO.Internal.gh..ctor(String A_0, PdfDocumentSecurity A_1)
   at EO.Pdf.PdfDocument..ctor(String fileName)
   at Program.Main() in f:\dev\TestPDF\TestPDF\Program.cs:line 7
eo_support
Posted: Wednesday, May 8, 2019 3:28:23 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

This usually indicates a corrupted PDF file. In such case we can look into it and see if we can ignore the block in question and still load the rest. You can send the PDF file to us and we will be happy to take a look. Please see here for our email address:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
Walden
Posted: Wednesday, May 8, 2019 4:19:53 PM
Rank: Member
Groups: Member

Joined: 3/18/2014
Posts: 15
EMail Sent.
eo_support
Posted: Friday, May 10, 2019 3:13:07 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

This is just to let you know that we have found the root of the problem. This will be resolved in our next build.

Thanks!
Walden
Posted: Friday, May 10, 2019 3:25:01 PM
Rank: Member
Groups: Member

Joined: 3/18/2014
Posts: 15
Terrific, thanks. Does the code change work around a bad PDF, or was there a bug. Just curious. And any ETA on the build? Rough numbers is fine, next week? Next month? Next quarter? :-)
eo_support
Posted: Friday, May 10, 2019 3:30:59 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
It was a bug on our end. We should have an update next week.
Walden
Posted: Friday, May 10, 2019 3:48:15 PM
Rank: Member
Groups: Member

Joined: 3/18/2014
Posts: 15
Awesome work as always. Thanks. Have a great weekend.
eo_support
Posted: Tuesday, May 14, 2019 7:44:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

This is just to let you know that we have posted a new build that should resolve the issue. You can download the new build from our download page. Please take a look and let us know how it goes.

Thanks!
Walden
Posted: Tuesday, May 14, 2019 7:56:00 PM
Rank: Member
Groups: Member

Joined: 3/18/2014
Posts: 15
Passes my sample test at least, so I'd say it's good. Build 19.1.40 is what I got from nuGet.

Thanks for the help, call it resolved! :-)

-W
eo_support
Posted: Wednesday, May 15, 2019 12:41:03 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Great. Thanks for confirming the fix!
OJ
Posted: Thursday, July 25, 2019 4:55:34 AM
Rank: Newbie
Groups: Member

Joined: 7/25/2019
Posts: 4
Hi,

unfortunately I have exactly the same issue, but I am already using the lastest Version (19.1.95.0) of EO.PDF.dll.

Code: Visual Basic.NET
at EO.Internal.an2.a(Byte[] A_0, Int32 A_1)
   at EO.Pdf.PdfDocumentSecurity.a.a(Byte[] A_0, Byte[] A_1, Byte[] A_2, Boolean A_3, Boolean A_4)
   at EO.Pdf.PdfDocumentSecurity.a.a(Stream A_0, Byte[] A_1, Stream A_2, Boolean A_3)
   at EO.Pdf.PdfDocumentSecurity.a.a(Int64 A_0, Int64 A_1, Stream A_2, Stream A_3, Boolean A_4)
   at EO.Pdf.PdfDocumentSecurity.a(Int64 A_0, Int64 A_1, Stream A_2, Stream A_3, Boolean A_4)
   at EO.Internal.us.a(PdfDocumentSecurity A_0, Int32 A_1, Int32 A_2)
   at EO.Internal.aiz.a.a(a2r A_0)
   at EO.Internal.ak.c(a2r A_0)
   at EO.Internal.ak.a(a2r A_0)
   at EO.Internal.ak.a(IEnumerable`1 A_0)
   at EO.Internal.aiz.a(PdfDocumentSecurity A_0)
   at EO.Internal.aiz.a(Boolean A_0, Boolean A_1, PdfDocumentSecurity A_2)
   at EO.Internal.fz.a(Stream A_0, Boolean A_1, Boolean A_2)
   at EO.Internal.fz.a(String A_0)
   at EO.Internal.fz..ctor(String A_0, PdfDocumentSecurity A_1)
   at EO.Pdf.PdfDocument..ctor(String fileName)


eo_support
Posted: Thursday, July 25, 2019 2:45:05 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

Can you send us the PDF file in question through our contact us page? Once we have the file, we will look into it and see what we can find.

Thanks!
OJ
Posted: Friday, July 26, 2019 3:51:17 AM
Rank: Newbie
Groups: Member

Joined: 7/25/2019
Posts: 4
Hi,

File sent.

eo_support
Posted: Monday, July 29, 2019 12:02:29 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
OJ wrote:
Hi,

File sent.



Hi,

This is just to let you know that we have found the root of the problem. This is a slightly different problem than the original problem mentioned in this thread, even though they both cause the same error message. The original problem was that an encrypted PDF file allows metadata in the file NOT to be encrypted and our code did not handle that scenario (our older version treated metadata as always encrypted). The issue in your file is that there is an empty 0 byte data block that is marked as encrypted, this is obviously not necessary and our code did not properly skip such block. This will be fixed in our next build.

Thanks!
OJ
Posted: Tuesday, July 30, 2019 2:53:42 AM
Rank: Newbie
Groups: Member

Joined: 7/25/2019
Posts: 4
Hi,

thanks for the quick Response.

When will the next build be available?

Regards
eo_support
Posted: Tuesday, July 30, 2019 9:17:58 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
We post updates quite frequently. It should be out in maybe two weeks.
eo_support
Posted: Friday, August 9, 2019 9:55:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

This is just to let you know that we have posted a new build that should fix this problem. You can download the new build from our download page. Please take a look and let us know how it goes.

Thanks!
OJ
Posted: Monday, August 12, 2019 11:57:01 AM
Rank: Newbie
Groups: Member

Joined: 7/25/2019
Posts: 4
Hi,

yes, it works again with the current Version.

Thanks!
eo_support
Posted: Monday, August 12, 2019 1:02:54 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Great. Thanks for confirming the fix!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.