Giter VIP home page Giter VIP logo

Comments (3)

ceztko avatar ceztko commented on May 20, 2024

Thank you for the research. Please also attach all the working and non working pdfs so they will be easily inspectable. This is an interesting topic but it's low priority for me and I don't have the resources to do it, right now.

from podofo.

ferencIOS avatar ferencIOS commented on May 20, 2024

ok I found a sample secured pdf here

These the results:

samplesecured.pdf
samplesecured-Signed-pdfbox.pdf
samplesecured-Signed-podofo.pdf

from podofo.

ferencIOS avatar ferencIOS commented on May 20, 2024

Hi, I did not forget! I haven't found a solution but I hope to give some useful hints.

Looking at the samplesecured.pdf and the two files signed by pdfbox and by PoDoFo the substantial difference is represented by the object:

6 1 obj
<</CF<</StdCF<</AuthEvent/DocOpen/CFM/AESV3/Length 32>>>>/Filter/Standard/Length 256/O<9EF36ED0D632E6D2F520D564ADDDF94FB3793E667832EBBFC977E0A13AB77A313DF4A2824721DC8FAF533F9B3599DBCC>/OE<3526E597E1D35623A92C61FF651EBE06C541B929C16EDF0106E869F218297E83>/P -3392/Perms<9C2A1F313E4E64608091C22711F6D473>/R 5/StmF/StdCF/StrF/StdCF/U<D2CFC4C207107A06F09ED9EE0F31E1A38B72A3048030F45D88518668F240538291B2B8EB03D7D60C3241776714CB4436>/UE<91D91A1B147CAC7DFE4B24A03A25297B71C5745DE8A387F7461A0F2F815B0AB5>/V 5>>

This object is created by PoDoFo following the

void PdfEncryptSHABase::CreateEncryptionDictionary(PdfDictionary& dictionary) const

and is used to create later:

24 1 obj
<</Type/XRef/Encrypt 6 1 R/Filter/FlateDecode/ID[<CC5 [...]

Why is the 6 1 obj created?
How does pdfbox use the 23 0 obj directly?


A few info extracted with podofo:

void PdfParserObject::checkReference(PdfTokenizer& tokenizer)

DEBUG: The PDF file is encrypted
WARNING: Found object with reference 0 0 R different than reported 23 0 R in XRef sections

void PdfMemDocument::initFromParser(PdfParser& parser)

DEBUG: <</Type/XRef/Encrypt 23 0 R/Filter/FlateDecode/ID[<CC56D8A7F574DE7ED75787D94BF65288><CC56D8A7F574DE7ED75787D94BF65288>]/Index[ 2 18 21 4]/Info 2 0 R/Length 76/Root 21 0 R/Size 25/W[ 1 2 1]>>

Trying to open the signed file

PoDoFo encountered an error. Error: 7PdfErrorCode::InternalLogic	Error Description: An internal error occurred.	Callstack:	#0 Error Source : main/PdfParser.cpp: 97		Information: Unable to load objects from file
	#1 Error Source : main/PdfParserObject.cpp: 96		Information: Unable to parse the stream for object 22 0 R
	#2 Error Source : main/PdfEncrypt.cpp: 404		Information: Error AES-decryption data padding

I tried to see what the competitors are doing too. The closest to PoDoFo is MuPdf!
Here instead the pdfbox encryption module

from podofo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.