summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfmx/src/pdfencrypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/dvipdfmx/src/pdfencrypt.c')
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfencrypt.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/Build/source/texk/dvipdfmx/src/pdfencrypt.c b/Build/source/texk/dvipdfmx/src/pdfencrypt.c
index 677febc3d5c..932b3960da1 100644
--- a/Build/source/texk/dvipdfmx/src/pdfencrypt.c
+++ b/Build/source/texk/dvipdfmx/src/pdfencrypt.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfencrypt.c,v 1.9 2007/04/03 05:25:50 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfencrypt.c,v 1.10 2008/02/12 18:44:40 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -143,8 +143,12 @@ static void compute_owner_password (void)
*/
if (revision == 3)
for (i = 0; i < 50; i++) {
+ /*
+ * NOTE: We truncate each MD5 hash as in the following step.
+ * Otherwise Adobe Reader won't decrypt the PDF file.
+ */
MD5_init(&md5_ctx);
- MD5_write(&md5_ctx, md5_buf, MAX_KEY_LEN);
+ MD5_write(&md5_ctx, md5_buf, key_size);
MD5_final(md5_buf, &md5_ctx);
}
/*
@@ -246,8 +250,12 @@ static void compute_encryption_key (unsigned char *pwd)
*/
if (revision == 3)
for (i = 0; i < 50; i++) {
+ /*
+ * NOTE: We truncate each MD5 hash as in the following step.
+ * Otherwise Adobe Reader won't decrypt the PDF file.
+ */
MD5_init(&md5_ctx);
- MD5_write(&md5_ctx, md5_buf, MAX_KEY_LEN);
+ MD5_write(&md5_ctx, md5_buf, key_size);
MD5_final(md5_buf, &md5_ctx);
}
/*