Didstopia / PDFSharp

A .NET Standard 2.0 library for reading, writing and editing PDF files.
MIT License
52 stars 18 forks source link

Fixing encryption problems #17

Closed ronnyek closed 6 years ago

ronnyek commented 6 years ago

I went ahead and did a pretty rudimentary swap of MD5Managed for MD5 .netcore official library. I was able to open files with no security provider, or incorrect password and get expected exceptions, went ahead and added a known PDF to tests and was able to open file with provided password successfully.

ronnyek commented 6 years ago

Admittedly, MD5Managed should be fully gutted, and not have two implementations of MD5 algorithms in place... but this shows things work this way

Dids commented 6 years ago

Haven't yet had a chance to properly go over this, but I'm assuming this would fix #3?

ronnyek commented 6 years ago

Yep, this fixes #3 (at least I think). I can make those minor changes, and I can evaluate whether or not the MD5Managed even needs to be there as its now a full blown library in nuget,

It doesnt open the original pdf with "password" as the password (dont know if thats correct or not, had no way that I could find to just test that it was indeed valid outside of this lib). It doesn't throw that exception, and successfully opens the other PDF I added with valid password "test" as well as fails with expected text. Might make sense to make that a specific exception, might not.

ronnyek commented 6 years ago

There we go, still waiting for travis build. Ended up being able to just opt for usage of microsofts fully managed MD5 provider, and all appears to be well.

Updated equality checks, and resolved all resharper warnings other than the name of the test file, which was nitpicky.