diff options
author | Albert Astals Cid <aacid@kde.org> | 2021-05-29 01:31:02 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2021-05-29 01:31:02 +0200 |
commit | dc587846bff99b07dc351d2d21e5b6908c99afdb (patch) | |
tree | 1a8dcab904269ef041d511e492f206adb60325e4 | |
parent | 9293e4bf9f6fa6513ddd51fe3426c39b54b1a49d (diff) |
pad ownerKey/userKey if < 32
Inspired by xpdf
-rw-r--r-- | poppler/SecurityHandler.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc index e5ec1007..a746f5a4 100644 --- a/poppler/SecurityHandler.cc +++ b/poppler/SecurityHandler.cc @@ -251,6 +251,17 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA, Object *encryptDi } else { error(errSyntaxError, -1, "Weird encryption info"); } + + if (encRevision <= 4) { + // Adobe apparently zero-pads the U value (and maybe the O value?) + // if it's short + while (ownerKey->getLength() < 32) { + ownerKey->append((char)0x00); + } + while (userKey->getLength() < 32) { + userKey->append((char)0x00); + } + } } StandardSecurityHandler::~StandardSecurityHandler() |