PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Regression since 1.50 beta 5 - encrypted file may be harmed
https://forum.pdfsharp.net/viewtopic.php?f=3&t=3817
Page 1 of 1

Author:  ta221 [ Fri Jul 27, 2018 6:30 pm ]
Post subject:  Regression since 1.50 beta 5 - encrypted file may be harmed

Hello there,

it was very important for me to note you about a PDF file being harmed after being encrypted with any password since v.1.50 beta 5 and onward.
The issue is that some of the background color on the page was changed after the encryption.
Although the unicode character issue in properties has been fixed for file encryptions in v.1.50 beta 5 - it feels that some files are being encrypted badly as the background color on these file may be changed as I described above.
It's important for me to note that the file was generated by SSRS 2008 which includes some background images.

The background change issue on the file was not present on v.1.50 beta 4 and also not on v.1.32...

i would like to send you the file itself for you to have tests on it, but I will send it to you privately as the file may contain copyrighted content. Please let me have your e-mail (G-mail is preffered) for me to provide you a link to access the file for tests.

Update
I found the issue on FormatStringLiteral on the file PdfEncoders.cs.
I'm afraid to say that before the fix for the unicode properties - the background color issue was not present.
After reverting the PdfEncoders.cs file to 1.50 beta 4 version only - I found the issue not presented anymore.
Unfortunately, I believe that some data on the file is changed incorrectly and this is why the issue occurs once file is encrypted.

Update 2
I applied the fix I previously did 1 year ago and the issue was not present anymore..
I have made the following changes:
- Use PdfEncoders.cs from version 1.50 beta 4.
- Add of enum: PdfStringFlags.BigEndianUnicode = 0x07.
- Add of Symbol.BigEndianUnicodeString which creates PDFString using (PdfStringFlags.BigEndianUnicode).
- Add of Symbol.BigEndianUnicodeHexString which creates PDFString using (PdfStringFlags.BigEndianUnicode | PdfStringFlags.HexLiteral).
- Replace of "return _symbol = Symbol.UnicodeString;" with "return _symbol = Symbol.BigEndianUnicodeString;" on Phase 2 for UTF-16BE.
- for Hex cases - replace of "return _symbol = Symbol.UnicodeHexString;" with "return _symbol = Symbol.BigEndianUnicodeHexString;".
- Add of enums: "Symbol.BigEndianUnicodeString" after "Symbol.UnicodeString" and "Symbol.BigEndianUnicodeHexString" after "Symbol.UnicodeHexString".
- Add of enum "PdfStringEncoding.BigEndianUnicode = PdfStringFlags.BigEndianUnicode" in PdfString.cs.
- Replace of "_flags = PdfStringFlags.Unicode;" with "_flags = PdfStringFlags.BigEndianUnicode | PdfStringFlags.HexLiteral;" on constructor of PdfString.
- Add of "case PdfStringEncoding.BigEndianUnicode: break;" on constructor of PdfString.

Thank you.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/