PdfSharpCore
PdfSharpCore copied to clipboard
Unable to open encrypted file with the owner password (only the user password works)
About a year or so back, I edited a private version of PdfSharp which was originally copied back before it had AES encryption, and made changes to allow me to open AES encrypted files (made no effort to ENCRYPT the files, since we already had the primitive 1.4 encryption and not so much time, and it was confusing that Encrypt/Decrypt were handled by the same method),
We wanted to update and get all the new stuff, and still had to make a change or two (not great changes, mostly dealing with null reference exceptions when _encryptionKey was referenced before it was defined) and that got us opening more of the files in our test suite, but we are still failing on one, but only with the owner password (user password works):
aa-7v-color-jinglebob8-pigsfly2.pdf
Trying to fix this locally (when our version opens this file with the owner password "pigsfly2" it first uses InitWithOwnerPassword to derive the userpassword with the confusingly named ComputeOwnerKey (which actually returns the padded user password "jinglebob8"). As far as I can tell, your current version includes the InitWithOwnerPassword method, but it is never called, and ComputeOwnerKey is only called when the file is encrypted (and, of course, from that method which is never called at all).
Thought you should know, and maybe you can include the attached file in your test suite?
If I can fix this and get permission from my company I will see about doing a pull request.