dimakoz / stunning-signature Goto Github PK
View Code? Open in Web Editor NEWNative Signature Verification For Android (with example)
License: MIT License
Native Signature Verification For Android (with example)
License: MIT License
Some one modded my app and copied my CERT.RSA from original app, and included in his META-INF and renamed it to com_android_support_support-core-ui.XSA ,
The cert verification results original signature. how is it possible?
It works fine with 'com.android.tools.build:gradle:3.4.0' but when i updated version to 'com.android.tools.build:gradle:3.6.3' it stops working any hint how to fix or help will be appreciated.
Hi. Thanks for your great work. Could you please help with building your demo project? Unfortunately I am not very experienced with native to resolve the next error:
Build command failed.
Error while executing process /home/alex/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/alex/Downloads/stunning-signature-master/app/.externalNativeBuild/cmake/debug/x86 --target native-lib}
[1/1] Re-running CMake...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/Downloads/stunning-signature-master/app/.externalNativeBuild/cmake/debug/x86
[1/1] Linking C shared library /home/alex/Downloads/stunning-signature-master/app/build/intermediates/cmake/debug/obj/x86/libnative-lib.so
FAILED: : && /home/alex/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=i686-none-linux-android19 --gcc-toolchain=/home/alex/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64 -fPIC --sysroot /home/alex/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o /home/alex/Downloads/stunning-signature-master/app/build/intermediates/cmake/debug/obj/x86/libnative-lib.so ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/native-lib.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/unzip_helper.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/path_helper.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/pkcs7_helper.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/third/minizip/mz_os.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/third/minizip/mz_os_posix.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/third/minizip/mz_strm_zlib.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/third/minizip/mz_strm.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/third/minizip/mz_strm_buf.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/third/minizip/mz_strm_mem.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/third/minizip/mz_strm_posix.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/third/minizip/mz_strm_split.c.o ../../../cxx/debug/x86/CMakeFiles/native-lib.dir/src/main/c/third/minizip/mz_zip.c.o /home/alex/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/19/liblog.so /usr/lib/libz.so -latomic -lm && :
/home/alex/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: /usr/lib/libz.so: incompatible target
/home/alex/Downloads/stunning-signature-master/app/src/main/c/third/minizip/mz_strm_zlib.c:91: error: undefined reference to 'deflateInit2_'
/home/alex/Downloads/stunning-signature-master/app/src/main/c/third/minizip/mz_strm_zlib.c:98: error: undefined reference to 'inflateInit2_'
/home/alex/Downloads/stunning-signature-master/app/src/main/c/third/minizip/mz_strm_zlib.c:164: error: undefined reference to 'inflate'
/home/alex/Downloads/stunning-signature-master/app/src/main/c/third/minizip/mz_strm_zlib.c:234: error: undefined reference to 'deflate'
/home/alex/Downloads/stunning-signature-master/app/src/main/c/third/minizip/mz_strm_zlib.c:296: error: undefined reference to 'deflateEnd'
/home/alex/Downloads/stunning-signature-master/app/src/main/c/third/minizip/mz_strm_zlib.c:300: error: undefined reference to 'inflateEnd'
/home/alex/Downloads/stunning-signature-master/app/src/main/c/third/minizip/mz_strm_zlib.c:389: error: undefined reference to 'get_crc_table'
/home/alex/Downloads/stunning-signature-master/app/src/main/c/third/minizip/mz_strm_zlib.c:384: error: undefined reference to 'crc32'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
char *pathHelperGetPath() {
char *package = getPackageName();
if (NULL == package) {
return NULL;
}
FILE *fp = fopen("/proc/self/maps", "r");
if (NULL == fp) {
free(package);
return NULL;
}
const size_t BUFFER_SIZE = 256;
char buffer[BUFFER_SIZE] = "";
char path[BUFFER_SIZE] = "";
bool find = false;
while (fgets(buffer, BUFFER_SIZE, fp)) {
if (sscanf(buffer, "%*llx-%*llx %*s %*s %*s %*s %s", path) == 1) {
**if (strstr(path, package) && (strstr(path, "/data/app/") || strstr(path, "/mnt/"))) {**
char *bname = basename(path);
NSV_LOGI("check basename[%s]", bname);
if (strcasecmp(getFilenameExt(bname), "apk") == 0) {
find = true;
break;
}
}
}
}
fclose(fp);
free(package);
if (find) {
return strdup(path);
}
return NULL;
}
After rebuilding using apktool and signapk.jar we can see the same signature
getting WARNING: ABIs [arm64-v8a,armeabi-v7a,armeabi] set by 'android.injected.build.abi' gradle flag contained 'ARMEABI' not targeted by this project.
warning during build. dont know the reason my ndk is v19
I suggest get PM from native code can do the samething.
replace
getPackageInfo(package, 0)[0]
with
env->GetMethodID(cz_pm,"getPackageInfo","(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;"
more ...
hi
thanks for your work.
i want to get md5 value of signature for check in runtime my apk is orginal. your code back byte of all signature.
how can get this?
Hey, is there a technical reason for this line?
usleep(500);
As it relies on the certificate being present in the META-INF directory. Also note that Android Studio will no longer insert the V1 signature when launching debug builds, so the check needs to be disabled in this situation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.