diff options
author | Matt Holgate <matt@emobix.co.uk> | 2014-06-27 12:30:39 +0100 |
---|---|---|
committer | Matt Holgate <matt@emobix.co.uk> | 2014-06-27 12:30:39 +0100 |
commit | 063a723b9fa50200192b01ba976ecd551461a8dc (patch) | |
tree | d66d0dc10e546470ed13bc5c9fc5720afed83c45 /platform/android/jni | |
parent | a51341c3e2ec46cb4759ca921c4fe011dc3d9dba (diff) | |
download | mupdf-063a723b9fa50200192b01ba976ecd551461a8dc.tar.xz |
Fix #695217 - don't allow annotation of encrypted PDFs
Diffstat (limited to 'platform/android/jni')
-rw-r--r-- | platform/android/jni/mupdf.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/android/jni/mupdf.c b/platform/android/jni/mupdf.c index 927fef3c..04f1ceff 100644 --- a/platform/android/jni/mupdf.c +++ b/platform/android/jni/mupdf.c @@ -514,6 +514,22 @@ JNI_FN(MuPDFCore_fileFormatInternal)(JNIEnv * env, jobject thiz) return (*env)->NewStringUTF(env, info); } +JNIEXPORT jboolean JNICALL +JNI_FN(MuPDFCore_isUnencryptedPDFInternal)(JNIEnv * env, jobject thiz) +{ + globals *glo = get_globals_any_thread(env, thiz); + if (glo == NULL) + return JNI_FALSE; + + pdf_document *idoc = pdf_specifics(glo->doc); + if (idoc == NULL) + return JNI_FALSE; // Not a PDF + + int cryptVer = pdf_crypt_version(idoc); + return (cryptVer == 0) ? JNI_TRUE : JNI_FALSE; +} + + JNIEXPORT void JNICALL JNI_FN(MuPDFCore_gotoPageInternal)(JNIEnv *env, jobject thiz, int page) { |