diff options
Diffstat (limited to 'apps/common')
-rw-r--r-- | apps/common/pdfapp.c | 14 | ||||
-rw-r--r-- | apps/common/pdftool.c | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/apps/common/pdfapp.c b/apps/common/pdfapp.c index b24cec3d..bfe09546 100644 --- a/apps/common/pdfapp.c +++ b/apps/common/pdfapp.c @@ -91,23 +91,23 @@ void pdfapp_open(pdfapp_t *app, char *filename) pdfapp_error(app, error); } - /* - * Handle encrypted PDF files - */ - error = pdf_decryptxref(app->xref); if (error) pdfapp_error(app, error); - if (app->xref->crypt) + /* + * Handle encrypted PDF files + */ + + if (pdf_needspassword(app->xref)) { - int okay = pdf_setpassword(app->xref->crypt, password); + int okay = pdf_authenticatepassword(app->xref, password); while (!okay) { password = winpassword(app, filename); if (!password) exit(1); - okay = pdf_setpassword(app->xref->crypt, password); + okay = pdf_authenticatepassword(app->xref, password); if (!okay) pdfapp_warn(app, "Invalid password."); } diff --git a/apps/common/pdftool.c b/apps/common/pdftool.c index 5de9e1b6..025dcd9b 100644 --- a/apps/common/pdftool.c +++ b/apps/common/pdftool.c @@ -50,9 +50,9 @@ void openxref(char *filename, char *password, int dieonbadpass) if (error) die(error); - if (xref->crypt) + if (pdf_needspassword(xref)) { - okay = pdf_setpassword(xref->crypt, password); + okay = pdf_authenticatepassword(xref, password); if (!okay && !dieonbadpass) fz_warn("invalid password, attempting to continue."); else if (!okay && dieonbadpass) |