pad ownerKey/userKey if < 32
Inspired by xpdf
diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
index e5ec100..a746f5a 100644
--- a/poppler/SecurityHandler.cc
+++ b/poppler/SecurityHandler.cc
@@ -251,6 +251,17 @@
} 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()