How to solve “Unknown encryption type R = 6” errors

About

How to solve “Unknown encryption type R = 6” errors

If you’ve ever encountered this error when opening or validating a PDF with iText 5 and earlier versions, then this article is for you! We’ll explore what this error message means, the reasons why you might encounter it, and the ways you can resolve it.

In recent months we’ve noticed an increasing number of questions on our Jira Support board, Stack Overflow, and indeed all over the Internet, all asking pretty much the same thing: What does “Unknown encryption type R = 6” mean, and how do I fix it?

If you’ve Googled this error and landed here, then congratulations! You’ve come to the right place. We’ll tell you all about what this mysterious error message means, why you’re seeing it, and most importantly how you can resolve it.

What does “Unknown encryption type R = 6” mean?

First things first though, let’s unpack exactly what this message is telling you. You’ve passed an encrypted PDF file to iText, and it has thrown an exception because it has encountered a type of password encryption that it does not understand. In the case of “Unknown encryption type R = 6” this refers to 256-bit AES encryption.

If you’re using iText 5/iTextSharp, or something even older like iText 2, then you’re increasingly likely to come across this error. If you’ve never encountered this error when dealing with encrypted PDFs, then you should be aware they are not secure by today’s standards – as we will soon learn.

To resolve the issue, you’ll need to use newer versions of iText (7.1 and later) that do understand this encryption type. If you need to upgrade though, you should seriously consider going straight to iText 8, which has just been released and supports even more modern PDF features. Incidentally, all versions of iText since 2009 have the exact same dual licensing scheme – AGPL and commercial – so there’s really nothing stopping you using the latest and greatest!

Why don’t older versions work though, and what types of PDF will cause the error? To answer that, first we’ll need to talk about how the PDF specification has evolved since its introduction.

 

Read the full article here

Share
November 2024
December 2024
No event found!

Related Topics