mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-08 00:14:35 +08:00
Fix reading encryption byte strings
This commit is contained in:
@@ -45,6 +45,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanReadDocumentWithUEAsString()
|
||||
{
|
||||
using (var document = PdfDocument.Open(IntegrationHelpers.GetSpecificTestDocumentPath("string_encryption_key.pdf")))
|
||||
{
|
||||
Assert.NotNull(document.Information.Producer);
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetPath() => IntegrationHelpers.GetSpecificTestDocumentPath(FileName);
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
%PDF-1.7
|
||||
%¿÷¢þ
|
||||
1 0 obj
|
||||
<< /Extensions << /ADBE << /BaseVersion /1.7 /ExtensionLevel 3 >> >> /Pages 3 0 R /Type /Catalog >>
|
||||
endobj
|
||||
2 0 obj
|
||||
<< /Producer <094f2e2e17e0eaa7fa21d7c01663d1642459a0e93ee2a2444ff6c3d9f606174a> >>
|
||||
endobj
|
||||
3 0 obj
|
||||
<< /Count 1 /Kids [ 4 0 R ] /MediaBox [ 0 0 595 792 ] /Type /Pages >>
|
||||
endobj
|
||||
4 0 obj
|
||||
<< /Contents 5 0 R /Parent 3 0 R /Resources << >> /Type /Page >>
|
||||
endobj
|
||||
5 0 obj
|
||||
<< /Length 96 /Filter /FlateDecode >>
|
||||
stream
|
||||
LŹ}ã?r[ NSüùZÕ’lRãë›f\EMðv`W‡%eK7""ÚÉ«@ä|<7C>ãÂÕe>שÆùê‡S¬Pm@”NïzÚ ‚ôc?èO¾L:m@Ïb1èTSÝú ê>Hîendstream
|
||||
endobj
|
||||
6 0 obj
|
||||
<< /CF << /StdCF << /AuthEvent /DocOpen /CFM /AESV3 /Length 32 >> >> /Filter /Standard /Length 256 /O <d93934d437eeefbe1d8f2c39179cf812a3a4c43b1bd58f3ffe6763f138d7f8ddbf5faa0552aa56e74e114d84b0280747> /OE <044007a2a9644d0c667f72665ae3eead400aa9a23671ef4c9991fe14ed7280c7> /P -4 /Perms <277a011382b0391bf31eb823942f104c> /R 5 /StmF /StdCF /StrF /StdCF /U <7dd74a14323c21b7b34cebd93864a73abd9d2c97bc0dd0c5bbaf699e3ae1a240d89a022bb1a897b60d9269403d5d337d> /UE (íXi€2/u·‡§SlЀŽwò$Çf¡Ê¡÷ÀkÝ|ü©ìz) /V 5 >>
|
||||
endobj
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000015 00000 n
|
||||
0000000130 00000 n
|
||||
0000000228 00000 n
|
||||
0000000313 00000 n
|
||||
0000000393 00000 n
|
||||
0000000559 00000 n
|
||||
trailer << /Info 2 0 R /Root 1 0 R /Size 7 /ID [<d9cc8dbe74307dd36f8a6b251c4ec862><d9cc8dbe74307dd36f8a6b251c4ec862>] /Encrypt 6 0 R >>
|
||||
startxref
|
||||
1074
|
||||
%%EOF
|
@@ -3,6 +3,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Core;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using Tokenization.Scanner;
|
||||
using Tokens;
|
||||
using Util;
|
||||
@@ -97,7 +99,7 @@
|
||||
var name = isUser ? NameToken.Ue : NameToken.Oe;
|
||||
if (encryptionDictionary.TryGet(name, tokenScanner, out StringToken? stringToken))
|
||||
{
|
||||
return OtherEncodings.StringAsLatin1Bytes(stringToken.Data);
|
||||
return stringToken.GetBytes();
|
||||
}
|
||||
|
||||
if (encryptionDictionary.TryGet(name, tokenScanner, out HexToken? hexToken))
|
||||
|
Reference in New Issue
Block a user