Can i break Adobe PDF password encryption with RC4/AES 128bits?
Asked Answered
R

1

0

I've encrypted some pdf files with iTextsharp lib and using AES 128bits and key length = 16bytes(protect reading).Can anyone break password or some app can do that? Thank so much.

Resect answered 15/4, 2012 at 15:6 Comment(3)
#1110652 this pretty much answers itFedora
thanks Mikey,but I'm using PDF encryption options of Adobe.I don't know it's the same with encrypt a file with AES 128bits or not?Resect
AES just means Advanced Encryption Standard - Adobe's version will adhere to the standard; either way - you're unlikely to crack it unless you have some serious computing power (think NSA supercomputer).Fedora
S
2

You can set 2 kinds of possible "passwords" here:

  • Read password
  • Edit/Modify password

Using an "edit password" is not secure at all, because it's possible to read the whole file (even without knowing the password, by using PdfReader.unethicalreading = true;) and then creating a new unencrypted one:

using System.IO;
using iTextSharp.text.pdf;

namespace PdfDecryptorCore
{
    public class PasswordDecryptor
    {
        public string ReadPassword { set; get; }        
        public string PdfPath { set; get; }
        public string OutputPdf { set; get; }

        public void DecryptPdf()
        {
            PdfReader.unethicalreading = true;

            PdfReader reader;
            if(string.IsNullOrWhiteSpace(ReadPassword))
             reader = new PdfReader(PdfPath);
            else
                reader = new PdfReader(PdfPath, System.Text.Encoding.UTF8.GetBytes(ReadPassword));

            using (var stamper = new PdfStamper(reader, new FileStream(OutputPdf, FileMode.Create)))
            {
                stamper.Close();
            }
        }
    }
}
Steeple answered 16/4, 2012 at 6:24 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.