mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-06-07 14:04:23 +02:00
Compare commits
No commits in common. "e983ba98d8d2ca72ef943332fc39c8a6470aaecd" and "5e9617a742b1d8546a21a6a1ecffa9d26f5d18e5" have entirely different histories.
e983ba98d8
...
5e9617a742
@ -582,7 +582,6 @@ _pdfioCryptoUnlock(
|
|||||||
file_idlen; // Length of file ID
|
file_idlen; // Length of file ID
|
||||||
_pdfio_md5_t md5; // MD5 context
|
_pdfio_md5_t md5; // MD5 context
|
||||||
uint8_t file_digest[16]; // MD5 digest of file ID and pad
|
uint8_t file_digest[16]; // MD5 digest of file ID and pad
|
||||||
double p; // Permissions value as a double
|
|
||||||
|
|
||||||
|
|
||||||
// See if we support the type of encryption specified by the Encrypt object
|
// See if we support the type of encryption specified by the Encrypt object
|
||||||
@ -690,13 +689,8 @@ _pdfioCryptoUnlock(
|
|||||||
|
|
||||||
// Grab the remaining values we need to unlock the PDF...
|
// Grab the remaining values we need to unlock the PDF...
|
||||||
pdf->file_keylen = (size_t)(length / 8);
|
pdf->file_keylen = (size_t)(length / 8);
|
||||||
|
pdf->permissions = (pdfio_permission_t)pdfioDictGetNumber(encrypt_dict, "P");
|
||||||
|
|
||||||
p = pdfioDictGetNumber(encrypt_dict, "P");
|
|
||||||
PDFIO_DEBUG("_pdfioCryptoUnlock: P=%.0f\n", p);
|
|
||||||
if (p < 0x7fffffff) // Handle integers > 2^31-1
|
|
||||||
pdf->permissions = (pdfio_permission_t)p;
|
|
||||||
else
|
|
||||||
pdf->permissions = (pdfio_permission_t)(p - 4294967296.0);
|
|
||||||
PDFIO_DEBUG("_pdfioCryptoUnlock: permissions=%d\n", pdf->permissions);
|
PDFIO_DEBUG("_pdfioCryptoUnlock: permissions=%d\n", pdf->permissions);
|
||||||
|
|
||||||
owner_key = pdfioDictGetBinary(encrypt_dict, "O", &owner_keylen);
|
owner_key = pdfioDictGetBinary(encrypt_dict, "O", &owner_keylen);
|
||||||
@ -999,11 +993,9 @@ make_owner_key(
|
|||||||
// Encrypt 20 times...
|
// Encrypt 20 times...
|
||||||
uint8_t encrypt_key[16]; // RC4 encryption key
|
uint8_t encrypt_key[16]; // RC4 encryption key
|
||||||
|
|
||||||
for (i = 20; i > 0;)
|
for (i = 0; i < 20; i ++)
|
||||||
{
|
{
|
||||||
// XOR each byte in the digest with the loop counter to make a key...
|
// XOR each byte in the digest with the loop counter to make a key...
|
||||||
i --;
|
|
||||||
|
|
||||||
for (j = 0; j < sizeof(encrypt_key); j ++)
|
for (j = 0; j < sizeof(encrypt_key); j ++)
|
||||||
encrypt_key[j] = (uint8_t)(digest[j] ^ i);
|
encrypt_key[j] = (uint8_t)(digest[j] ^ i);
|
||||||
|
|
||||||
|
@ -397,23 +397,19 @@ _pdfioValueRead(pdfio_file_t *pdf, // I - PDF file
|
|||||||
|
|
||||||
ret = v;
|
ret = v;
|
||||||
}
|
}
|
||||||
else if (token[0] == '(')
|
else if ((timeval = get_date_time(token + 1)) != 0)
|
||||||
{
|
{
|
||||||
if ((timeval = get_date_time(token + 1)) != 0)
|
|
||||||
{
|
|
||||||
// Date
|
|
||||||
v->type = PDFIO_VALTYPE_DATE;
|
v->type = PDFIO_VALTYPE_DATE;
|
||||||
v->value.date = timeval;
|
v->value.date = timeval;
|
||||||
ret = v;
|
ret = v;
|
||||||
}
|
}
|
||||||
else
|
else if (token[0] == '(')
|
||||||
{
|
{
|
||||||
// String
|
// String
|
||||||
v->type = PDFIO_VALTYPE_STRING;
|
v->type = PDFIO_VALTYPE_STRING;
|
||||||
v->value.string = pdfioStringCreate(pdf, token + 1);
|
v->value.string = pdfioStringCreate(pdf, token + 1);
|
||||||
ret = v;
|
ret = v;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (token[0] == '/')
|
else if (token[0] == '/')
|
||||||
{
|
{
|
||||||
// Name
|
// Name
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
# ./test-corpus.sh DIRECTORY
|
# ./test-corpus.sh DIRECTORY
|
||||||
#
|
#
|
||||||
|
|
||||||
if test $# = 0; then
|
if test $# = 1; then
|
||||||
echo "Usage: ./test-corpus.sh DIRECTORY"
|
echo "Usage: ./test-corpus.sh DIRECTORY"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in $(find "$@" -name \*.pdf -print); do
|
for file in $(find "$@" -name \*.pdf -print); do
|
||||||
./testpdfio $file 2>&1 >$file.log || echo $file
|
./testpdfio $file 2>$file.log || echo $file
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user