{"id":1778,"date":"2022-12-05T16:35:36","date_gmt":"2022-12-05T08:35:36","guid":{"rendered":"https:\/\/pjq.me\/?p=1778"},"modified":"2023-02-06T13:24:19","modified_gmt":"2023-02-06T05:24:19","slug":"chatgpt","status":"publish","type":"post","link":"https:\/\/pjq.me\/?p=1778","title":{"rendered":"ChatGPT &#8211; Generate Android Signature JNI Check Solution"},"content":{"rendered":"\n<p>ChatGPT\u592a\u5f3a\u4e86\uff0c\u8fd9\u91cc\u5c55\u793a\u4e00\u4e2a\u5982\u4f55\u8ba9\u5b83\u5e2e\u4f60\u751f\u6210JNI\u6821\u9a8cAndroid Signature\u7684\u4ee3\u7801\uff0c\u51e0\u5206\u949f\u641e\u5b9a<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/pjq.me\/?p=1778\/#Input\" >Input<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/pjq.me\/?p=1778\/#Output\" >Output<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Input\"><\/span>Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As Android developer, I want to protect my App from hacked during the App launch, so I need to do App signature check before the user start to use the App. The prefered way is hardcode the App&#8217;s signature in the JNI code, and run the JNI code when the App start, can you show the solution and code?<\/p>\n\n\n\n<p>\u540e\u9762\u6211\u8fd8\u8bd5\u4e86\u4fee\u6b63\u7684\u7248\u672c<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>As Android developer, I want to do the check App signature check before the user start to use the App, so I know it&#8217;s not hacked. The prefered way is hardcode the App&#8217;s signature in the JNI code, and run the JNI code when the App start, The package name is me.pjq.android The JNI method name is `check_signature`, the return type is true or false. The App&#8217;s original signature should be hardcoded in the JNI code but not the plaintext and readable, the original signature should be masked. can you show the solution and code and full structure of the App?<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Output\"><\/span>Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To perform an App signature check in JNI code, you can follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Get the App&#8217;s signature:<\/li>\n<\/ol>\n\n\n\n<p>First, you need to get the App&#8217;s signature. You can use the PackageInfo class to retrieve the App&#8217;s signature.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);\nSignature[] signatures = packageInfo.signatures;\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Convert the signature to a string:<\/li>\n<\/ol>\n\n\n\n<p>Next, you need to convert the signature to a string. You can use the Signature.toCharsString() method to convert the signature to a string.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>String signatureString = signatures[0].toCharsString();\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Pass the signature string to the JNI code:<\/li>\n<\/ol>\n\n\n\n<p>Then, you need to pass the signature string to the JNI code. You can use the JNI SetStringField() method to pass the signature string to the JNI code.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>jstring signatureString = env-&gt;NewStringUTF(signatureString);\nenv-&gt;SetObjectField(obj, env-&gt;GetFieldID(env-&gt;GetObjectClass(obj), \"signature\", \"Ljava\/lang\/String;\"), signatureString);\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>Verify the signature in the JNI code:<\/li>\n<\/ol>\n\n\n\n<p>In the JNI code, you can verify the signature by comparing the signature string with the hardcoded signature. If the signatures match, the App is considered to be authentic and can be launched. Otherwise, the App is considered to be hacked and should not be launched.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>jstring signature = (jstring) env-&gt;GetObjectField(obj, env-&gt;GetFieldID(env-&gt;GetObjectClass(obj), \"signature\", \"Ljava\/lang\/String;\"));\nconst char* signatureString = env-&gt;GetStringUTFChars(signature, 0);\n\nif (strcmp(signatureString, \"hardcoded_signature\") == 0) {\n    \/\/ App is authentic, launch the App\n} else {\n    \/\/ App is hacked, do not launch the App\n}\n\nenv-&gt;ReleaseStringUTFChars(signature, signatureString);\n<\/code><\/pre>\n\n\n\n<p>Note: The hardcoded signature should be kept secret and not included in the App&#8217;s code to prevent it from being hacked.<\/p>\n\n\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\" alt=\"Jianqing Peng\"\/><\/figure>\n\n\n\n<p>Continue<\/p>\n\n\n\n<p>After verifying the App&#8217;s signature in the JNI code, you can launch the App by calling the appropriate Android activity. For example, you can use the JNI StartActivity() method to launch the main activity of the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>jclass activityClass = env-&gt;FindClass(\"android\/app\/Activity\");\njmethodID startActivityMethod = env-&gt;GetMethodID(activityClass, \"startActivity\", \"(Landroid\/content\/Intent;)V\");\n\njclass intentClass = env-&gt;FindClass(\"android\/content\/Intent\");\njmethodID intentConstructor = env-&gt;GetMethodID(intentClass, \"&lt;init&gt;\", \"(Landroid\/content\/Context;Ljava\/lang\/Class;)V\");\n\njclass mainActivityClass = env-&gt;FindClass(\"com\/example\/app\/MainActivity\");\n\njobject intent = env-&gt;NewObject(intentClass, intentConstructor, obj, mainActivityClass);\n\nenv-&gt;CallVoidMethod(obj, startActivityMethod, intent);\n<\/code><\/pre>\n\n\n\n<p>Note: The main activity class name, &#8220;com\/example\/app\/MainActivity&#8221; in the above code, should be replaced with the actual main activity class name of your App.<\/p>\n\n\n\n<p>The complete JNI code for performing an App signature check and launching the App can be as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>#include &lt;jni.h&gt;\n#include &lt;string.h&gt;\n\nextern \"C\"\nJNIEXPORT void JNICALL\nJava_com_example_app_App_launch(JNIEnv *env, jobject obj) {\n    \/\/ Verify the App's signature\n    jstring signature = (jstring) env-&gt;GetObjectField(obj, env-&gt;GetFieldID(env-&gt;GetObjectClass(obj), \"signature\", \"Ljava\/lang\/String;\"));\n    const char* signatureString = env-&gt;GetStringUTFChars(signature, 0);\n\n    if (strcmp(signatureString, \"hardcoded_signature\") == 0) {\n        \/\/ App is authentic, launch the App\n        jclass activityClass = env-&gt;FindClass(\"android\/app\/Activity\");\n        jmethodID startActivityMethod = env-&gt;GetMethodID(activityClass, \"startActivity\", \"(Landroid\/content\/Intent;)V\");\n\n        jclass intentClass = env-&gt;FindClass(\"android\/content\/Intent\");\n        jmethodID intentConstructor = env-&gt;GetMethodID(intentClass, \"&lt;init&gt;\", \"(Landroid\/content\/Context;Ljava\/lang\/Class;)V\");\n\n        jclass mainActivityClass = env-&gt;FindClass(\"com\/example\/app\/MainActivity\");\n\n        jobject intent = env-&gt;NewObject(intentClass, intentConstructor, obj, mainActivityClass);\n\n        env-&gt;CallVoidMethod(obj, startActivityMethod, intent);\n    } else {\n        \/\/ App is hacked, do not launch the App\n    }\n\n    env-&gt;ReleaseStringUTFChars(signature, signatureString);\n}\n<\/code><\/pre>\n\n\n\n<p>In the Java code, you can call the JNI launch() method to perform the App signature check and launch the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>public class App {\n    public static native void launch();\n\n    static {\n        System.loadLibrary(\"app\");\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>You can call the launch() method in the onCreate() method of the App&#8217;s main activity to perform the App signature check<\/p>\n\n\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\" alt=\"Jianqing Peng\"\/><\/figure>\n\n\n\n<p>Continue<\/p>\n\n\n\n<p>and launch the App when the App is launched.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>public class MainActivity extends AppCompatActivity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        \/\/ Perform App signature check and launch the App\n        App.launch();\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Note: The above code assumes that the JNI library &#8220;app&#8221; is already built and placed in the App&#8217;s libs directory.<\/p>\n\n\n\n<p>This is the general solution for performing an App signature check in JNI code and launching the App. It is important to note that this solution is not foolproof and can be hacked if the attacker is determined and skilled enough. Therefore, it is recommended to use other security measures such as using a secure server to store the App&#8217;s signature and performing the signature check on the server.<\/p>\n\n\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\" alt=\"Jianqing Peng\"\/><\/figure>\n\n\n\n<p>Show me the make file<\/p>\n\n\n\n<p>To build the JNI library, you need to create a makefile with the following content:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>LOCAL_PATH := $(call my-dir)\n\ninclude $(CLEAR_VARS)\n\nLOCAL_MODULE    := app\nLOCAL_SRC_FILES := app.cpp\n\ninclude $(BUILD_SHARED_LIBRARY)\n<\/code><\/pre>\n\n\n\n<p>You can use the make command to build the JNI library.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>$ make app\n<\/code><\/pre>\n\n\n\n<p>The JNI library will be built and placed in the libs directory. You can then include the JNI library in your Android project and use it as explained in the previous solution.<\/p>\n\n\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\" alt=\"Jianqing Peng\"\/><\/figure>\n\n\n\n<p>Show me the full structure of the App<\/p>\n\n\n\n<p>Here is the general structure of the App that performs an App signature check in JNI code and launches the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>- app\/\n  - src\/\n    - main\/\n      - java\/\n        - com\/\n          - example\/\n            - app\/\n              - App.java\n              - MainActivity.java\n      - jni\/\n        - app.cpp\n  - libs\/\n    - armeabi\/\n      - libapp.so\n  - Makefile\n  - Android.mk\n<\/code><\/pre>\n\n\n\n<p>The App.java file contains the JNI launch() method that performs the App signature check and launches the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>public class App {\n    public static native void launch();\n\n    static {\n        System.loadLibrary(\"app\");\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>The MainActivity.java file contains the onCreate() method that calls the JNI launch() method to perform the App signature check and launch the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>public class MainActivity extends AppCompatActivity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        \/\/ Perform App signature check and launch the App\n        App.launch();\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>The app.cpp file contains the JNI code that verifies the App&#8217;s signature and launches the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>#include &lt;jni.h&gt;\n#include &lt;string.h&gt;\n\nextern \"C\"\nJNIEXPORT void JNICALL\nJava_com_example_app_App_launch(JNIEnv *env, jobject obj) {\n    \/\/ Verify the App's signature\n    jstring signature = (jstring) env-&gt;GetObjectField(obj, env-&gt;GetFieldID(env-&gt;GetObjectClass(obj), \"signature\", \"Ljava\/lang\/String;\"));\n    const char* signatureString = env-&gt;GetStringUTFChars(signature, 0);\n\n    if (strcmp(signatureString, \"hardcoded_signature\") == 0) {\n        \/\/ App is authentic, launch the App\n        jclass activityClass = env-&gt;FindClass(\"android\/app\/Activity\");\n        jmethodID startActivityMethod = env-&gt;GetMethodID(activityClass, \"startActivity\", \"(Landroid\/content\/Intent;)V\");\n\n        jclass intentClass = env-&gt;FindClass(\"android\/content\/Intent\");\n        jmethodID intentConstructor = env-&gt;GetMethodID(intentClass, \"&lt;init&gt;\", \"(Landroid\/content\/Context;Ljava\/lang\/Class;)V\");\n\n        jclass mainActivityClass = env-&gt;FindClass(\"com\/example\/app\/MainActivity\");\n\n        jobject intent = env-&gt;NewObject(intentClass, intentConstructor, obj, mainActivityClass);\n\n        env-&gt;CallVoidMethod(obj, startActivityMethod, intent);\n    } else {\n        \/\/ App is hacked, do not launch the App\n    }\n\n    env-&gt;ReleaseStringUTFChars(signature, signatureString);\n}\n<\/code><\/pre>\n\n\n\n<p>The Makefile contains the instructions to build the JNI library.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>LOCAL_PATH := $(call my-dir)\n\ninclude $(CLEAR_VARS)\n\nLOCAL_MODULE    := app\nLOCAL\n<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\" alt=\"Jianqing Peng\"\/><\/figure>\n\n\n\n<p>The package name is me.pjq.android<\/p>\n\n\n\n<p>Here is the updated structure of the App that performs an App signature check in JNI code and launches the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>- app\/\n  - src\/\n    - main\/\n      - java\/\n        - me\/\n          - pjq\/\n            - android\/\n              - App.java\n              - MainActivity.java\n      - jni\/\n        - app.cpp\n  - libs\/\n    - armeabi\/\n      - libapp.so\n  - Makefile\n  - Android.mk\n<\/code><\/pre>\n\n\n\n<p>The App.java file contains the JNI launch() method that performs the App signature check and launches the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>package me.pjq.android;\n\npublic class App {\n    public static native void launch();\n\n    static {\n        System.loadLibrary(\"app\");\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>The MainActivity.java file contains the onCreate() method that calls the JNI launch() method to perform the App signature check and launch the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>package me.pjq.android;\n\npublic class MainActivity extends AppCompatActivity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        \/\/ Perform App signature check and launch the App\n        App.launch();\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>The app.cpp file contains the JNI code that verifies the App&#8217;s signature and launches the App.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>#include &lt;jni.h&gt;\n#include &lt;string.h&gt;\n\nextern \"C\"\nJNIEXPORT void JNICALL\nJava_me_pjq_android_App_launch(JNIEnv *env, jobject obj) {\n    \/\/ Verify the App's signature\n    jstring signature = (jstring) env-&gt;GetObjectField(obj, env-&gt;GetFieldID(env-&gt;GetObjectClass(obj), \"signature\", \"Ljava\/lang\/String;\"));\n    const char* signatureString = env-&gt;GetStringUTFChars(signature, 0);\n\n    if (strcmp(signatureString, \"hardcoded_signature\") == 0) {\n        \/\/ App is authentic, launch the App\n        jclass activityClass = env-&gt;FindClass(\"android\/app\/Activity\");\n        jmethodID startActivityMethod = env-&gt;GetMethodID(activityClass, \"startActivity\", \"(Landroid\/content\/Intent;)V\");\n\n        jclass intentClass = env-&gt;FindClass(\"android\/content\/Intent\");\n        jmethodID intentConstructor = env-&gt;GetMethodID(intentClass, \"&lt;init&gt;\", \"(Landroid\/content\/Context;Ljava\/lang\/Class;)V\");\n\n        jclass mainActivityClass = env-&gt;FindClass(\"me\/pjq\/android\/MainActivity\");\n\n        jobject intent = env-&gt;NewObject(intentClass, intentConstructor, obj, mainActivityClass);\n\n        env-&gt;CallVoidMethod(obj, startActivityMethod, intent);\n    } else {\n        \/\/ App is hacked, do not launch the App\n    }\n\n    env-&gt;ReleaseStringUTFChars(signature, signatureString);\n}\n<\/code><\/pre>\n\n\n\n<p>The Makefile contains the instructions to build the JNI library.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>LOCAL_PATH := $(\n<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\" alt=\"Jianqing Peng\"\/><\/figure>\n\n\n\n<p>continue<\/p>\n\n\n\n<p>call my-dir)<\/p>\n\n\n\n<p>include $(CLEAR_VARS)<\/p>\n\n\n\n<p>LOCAL_MODULE := app LOCAL_SRC_FILES := app.cpp<\/p>\n\n\n\n<p>include $(BUILD_SHARED_LIBRARY)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>\nYou can use the make command to build the JNI library.\n\n<\/code><\/pre>\n\n\n\n<p>$ make app<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Copy code<code>\nThe JNI library will be built and placed in the libs directory. You can then include the JNI library in your Android project and use it as explained in the previous solution.\n\nNote: The package name, \"me.pjq.android\" in the above code, should be replaced with the actual package name of your App.<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>ChatGPT\u592a\u5f3a\u4e86\uff0c\u8fd9\u91cc\u5c55\u793a\u4e00\u4e2a\u5982\u4f55\u8ba9\u5b83\u5e2e\u4f60\u751f\u6210JNI\u6821\u9a8cAndroid Signature\u7684\u4ee3\u7801\uff0c\u51e0\u5206\u949f\u641e\u5b9a Input As Android developer, I want to protect my App from hacked during the App launch, so I need to do App signature check before the user start to use the App. The prefered way is hardcode the<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[169],"tags":[202,50,200,201],"class_list":["post-1778","post","type-post","status-publish","format-standard","hentry","category-tech","tag-ai","tag-android","tag-chatgpt","tag-jni"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ChatGPT - Generate Android Signature JNI Check Solution - Jianqing&#039;s Blog<\/title>\n<meta name=\"description\" content=\"This blog will show how to use ChatGPT to generate the Android Signature JNI check solution\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pjq.me\/?p=1778\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ChatGPT - Generate Android Signature JNI Check Solution - Jianqing&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"This blog will show how to use ChatGPT to generate the Android Signature JNI check solution\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pjq.me\/?p=1778\" \/>\n<meta property=\"og:site_name\" content=\"Jianqing&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-05T08:35:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-06T05:24:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\" \/>\n<meta name=\"author\" content=\"pengjianqing\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pengjianqing\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/pjq.me\/?p=1778#article\",\"isPartOf\":{\"@id\":\"https:\/\/pjq.me\/?p=1778\"},\"author\":{\"name\":\"pengjianqing\",\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"headline\":\"ChatGPT &#8211; Generate Android Signature JNI Check Solution\",\"datePublished\":\"2022-12-05T08:35:36+00:00\",\"dateModified\":\"2023-02-06T05:24:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/pjq.me\/?p=1778\"},\"wordCount\":872,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"image\":{\"@id\":\"https:\/\/pjq.me\/?p=1778#primaryimage\"},\"thumbnailUrl\":\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\",\"keywords\":[\"AI\",\"Android\",\"ChatGPT\",\"JNI\"],\"articleSection\":[\"Tech\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/pjq.me\/?p=1778#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/pjq.me\/?p=1778\",\"url\":\"https:\/\/pjq.me\/?p=1778\",\"name\":\"ChatGPT - Generate Android Signature JNI Check Solution - Jianqing&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/pjq.me\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/pjq.me\/?p=1778#primaryimage\"},\"image\":{\"@id\":\"https:\/\/pjq.me\/?p=1778#primaryimage\"},\"thumbnailUrl\":\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\",\"datePublished\":\"2022-12-05T08:35:36+00:00\",\"dateModified\":\"2023-02-06T05:24:19+00:00\",\"description\":\"This blog will show how to use ChatGPT to generate the Android Signature JNI check solution\",\"breadcrumb\":{\"@id\":\"https:\/\/pjq.me\/?p=1778#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/pjq.me\/?p=1778\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pjq.me\/?p=1778#primaryimage\",\"url\":\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\",\"contentUrl\":\"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/pjq.me\/?p=1778#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/pjq.me\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ChatGPT &#8211; Generate Android Signature JNI Check Solution\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/pjq.me\/#website\",\"url\":\"https:\/\/pjq.me\/\",\"name\":\"Jianqing&#039;s Blog\",\"description\":\"Thoughts and Future\",\"publisher\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/pjq.me\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\",\"name\":\"pengjianqing\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png\",\"contentUrl\":\"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png\",\"width\":460,\"height\":752,\"caption\":\"pengjianqing\"},\"logo\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/pjq.me\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ChatGPT - Generate Android Signature JNI Check Solution - Jianqing&#039;s Blog","description":"This blog will show how to use ChatGPT to generate the Android Signature JNI check solution","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pjq.me\/?p=1778","og_locale":"en_US","og_type":"article","og_title":"ChatGPT - Generate Android Signature JNI Check Solution - Jianqing&#039;s Blog","og_description":"This blog will show how to use ChatGPT to generate the Android Signature JNI check solution","og_url":"https:\/\/pjq.me\/?p=1778","og_site_name":"Jianqing&#039;s Blog","article_published_time":"2022-12-05T08:35:36+00:00","article_modified_time":"2023-02-06T05:24:19+00:00","og_image":[{"url":"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75","type":"","width":"","height":""}],"author":"pengjianqing","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pengjianqing","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pjq.me\/?p=1778#article","isPartOf":{"@id":"https:\/\/pjq.me\/?p=1778"},"author":{"name":"pengjianqing","@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"headline":"ChatGPT &#8211; Generate Android Signature JNI Check Solution","datePublished":"2022-12-05T08:35:36+00:00","dateModified":"2023-02-06T05:24:19+00:00","mainEntityOfPage":{"@id":"https:\/\/pjq.me\/?p=1778"},"wordCount":872,"commentCount":0,"publisher":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"image":{"@id":"https:\/\/pjq.me\/?p=1778#primaryimage"},"thumbnailUrl":"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75","keywords":["AI","Android","ChatGPT","JNI"],"articleSection":["Tech"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pjq.me\/?p=1778#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pjq.me\/?p=1778","url":"https:\/\/pjq.me\/?p=1778","name":"ChatGPT - Generate Android Signature JNI Check Solution - Jianqing&#039;s Blog","isPartOf":{"@id":"https:\/\/pjq.me\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pjq.me\/?p=1778#primaryimage"},"image":{"@id":"https:\/\/pjq.me\/?p=1778#primaryimage"},"thumbnailUrl":"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75","datePublished":"2022-12-05T08:35:36+00:00","dateModified":"2023-02-06T05:24:19+00:00","description":"This blog will show how to use ChatGPT to generate the Android Signature JNI check solution","breadcrumb":{"@id":"https:\/\/pjq.me\/?p=1778#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pjq.me\/?p=1778"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pjq.me\/?p=1778#primaryimage","url":"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75","contentUrl":"https:\/\/chat.openai.com\/_next\/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FAEdFTp7rnbPWUnx5FfeOf_2Y5jgJ85lJEz1UGnoCErhsbYU%3Ds96-c&amp;w=64&amp;q=75"},{"@type":"BreadcrumbList","@id":"https:\/\/pjq.me\/?p=1778#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pjq.me\/"},{"@type":"ListItem","position":2,"name":"ChatGPT &#8211; Generate Android Signature JNI Check Solution"}]},{"@type":"WebSite","@id":"https:\/\/pjq.me\/#website","url":"https:\/\/pjq.me\/","name":"Jianqing&#039;s Blog","description":"Thoughts and Future","publisher":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pjq.me\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60","name":"pengjianqing","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pjq.me\/#\/schema\/person\/image\/","url":"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png","contentUrl":"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png","width":460,"height":752,"caption":"pengjianqing"},"logo":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/image\/"},"url":"https:\/\/pjq.me\/?author=1"}]}},"views":2406,"_links":{"self":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/1778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1778"}],"version-history":[{"count":3,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/1778\/revisions"}],"predecessor-version":[{"id":1783,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/1778\/revisions\/1783"}],"wp:attachment":[{"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}