From b674a68e91824e82f2930f47a4ee33ef2e66f5b0 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Mon, 8 Oct 2012 23:02:29 +0200 Subject: Add showing of encryption dictionary to pdfshow --- apps/pdfshow.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'apps/pdfshow.c') diff --git a/apps/pdfshow.c b/apps/pdfshow.c index 655493f9..275c5e18 100644 --- a/apps/pdfshow.c +++ b/apps/pdfshow.c @@ -28,6 +28,20 @@ static void showtrailer(void) printf("\n"); } +static void showencrypt(void) +{ + pdf_obj *encrypt; + + if (!doc) + fz_throw(ctx, "no file specified"); + encrypt = pdf_dict_gets(doc->trailer, "Encrypt"); + if (!encrypt) + fz_throw(ctx, "document not encrypted"); + printf("encryption dictionary\n"); + pdf_fprint_obj(stdout, pdf_resolve_indirect(encrypt), 0); + printf("\n"); +} + static void showxref(void) { if (!doc) @@ -217,6 +231,7 @@ int pdfshow_main(int argc, char **argv) switch (argv[fz_optind][0]) { case 't': showtrailer(); break; + case 'e': showencrypt(); break; case 'x': showxref(); break; case 'p': showpagetree(); break; case 'g': showgrep(filename); break; -- cgit v1.2.3