Untitled
unknown
plain_text
19 days ago
981 B
2
Indexable
Never
#include <jni.h> #include <string> #include <android/log.h> #define LOG_TAG "NativeSignatureCheck" #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) extern "C" JNIEXPORT jstring JNICALL Java_com_example_myapp_MainActivity_checkSignature(JNIEnv *env, jobject /* this */) { jclass signatureHelperClass = env->FindClass("com/example/myapp/SignatureHelper"); jmethodID getAppSignatureMethod = env->GetStaticMethodID(signatureHelperClass, "getAppSignature", "()Ljava/lang/String;"); // Gọi hàm Java từ mã native jstring signatureBase64 = (jstring) env->CallStaticObjectMethod(signatureHelperClass, getAppSignatureMethod); const char *signature = env->GetStringUTFChars(signatureBase64, NULL); // In chữ ký để kiểm tra LOGI("App signature: %s", signature); // Release memory env->ReleaseStringUTFChars(signatureBase64, signature); return signatureBase64; }
Leave a Comment