diff options
author | Sebastian Rasmussen <sebras@hotmail.com> | 2010-12-10 21:27:26 +0000 |
---|---|---|
committer | Sebastian Rasmussen <sebras@hotmail.com> | 2010-12-10 21:27:26 +0000 |
commit | af3b2666c907a56a584db4be581fcb8b56a6c636 (patch) | |
tree | 70a337201c1c340b377bc12eaa184769bec15941 | |
parent | b163d64c88cd929d1e247fe86e55d457d2a59355 (diff) | |
download | mupdf-af3b2666c907a56a584db4be581fcb8b56a6c636.tar.xz |
Add debug printing function for encryption information.
-rw-r--r-- | mupdf/mupdf.h | 2 | ||||
-rw-r--r-- | mupdf/pdf_crypt.c | 37 |
2 files changed, 26 insertions, 13 deletions
diff --git a/mupdf/mupdf.h b/mupdf/mupdf.h index 52fe415b..70b130c7 100644 --- a/mupdf/mupdf.h +++ b/mupdf/mupdf.h @@ -112,6 +112,8 @@ void pdf_cryptobj(pdf_crypt *crypt, fz_obj *obj, int num, int gen); int pdf_needspassword(pdf_xref *xref); int pdf_authenticatepassword(pdf_xref *xref, char *pw); +void pdf_debugcrypt(pdf_crypt *crypt); + /* * xref and object / stream api */ diff --git a/mupdf/pdf_crypt.c b/mupdf/pdf_crypt.c index 1b0f0787..019f889c 100644 --- a/mupdf/pdf_crypt.c +++ b/mupdf/pdf_crypt.c @@ -182,19 +182,6 @@ pdf_newcrypt(pdf_crypt **cryptp, fz_obj *dict, fz_obj *id) else fz_warn("missing file identifier, may not be able to do decryption"); -#if 0 - { - int i; - printf("crypt: v=%d length=%d\n", crypt->v, crypt->length); - printf("crypt: stmf method=%d length=%d\n", crypt->stmf.method, crypt->stmf.length); - printf("crypt: strf method=%d length=%d\n", crypt->strf.method, crypt->strf.length); - printf("crypt: r=%d\n", crypt->r); - printf("crypt: o=<"); for (i = 0; i < 32; i++) printf("%02X", crypt->o[i]); printf(">\n"); - printf("crypt: u=<"); for (i = 0; i < 32; i++) printf("%02X", crypt->u[i]); printf(">\n"); - printf("crypt: p=0x%08X\n", crypt->p); - } -#endif - *cryptp = crypt; return fz_okay; } @@ -604,3 +591,27 @@ pdf_opencrypt(fz_stream *chain, pdf_crypt *crypt, pdf_cryptfilter *stmf, int num return fz_opencopy(chain); } + +void pdf_debugcrypt(pdf_crypt *crypt) +{ + int i; + + printf("crypt {\n"); + + printf("\tv=%d length=%d\n", crypt->v, crypt->length); + printf("\tstmf method=%d length=%d\n", crypt->stmf.method, crypt->stmf.length); + printf("\tstrf method=%d length=%d\n", crypt->strf.method, crypt->strf.length); + printf("\tr=%d\n", crypt->r); + + printf("\to=<"); + for (i = 0; i < 32; i++) + printf("%02X", crypt->o[i]); + printf(">\n"); + + printf("\tu=<"); + for (i = 0; i < 32; i++) + printf("%02X", crypt->u[i]); + printf(">\n"); + + printf("}\n"); +} |