├── ApkSignatureDigest ├── settings.gradle ├── app │ ├── app-release.apk │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── styles.xml │ │ │ │ │ └── attrs.xml │ │ │ │ ├── drawable │ │ │ │ │ └── btn_get_sign.xml │ │ │ │ └── layout │ │ │ │ │ └── activity_apk_signature.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── whinc │ │ │ │ └── apksignaturedigest │ │ │ │ ├── PackageUtils.java │ │ │ │ └── ApkSignatureActivity.java │ │ └── androidTest │ │ │ └── java │ │ │ └── com │ │ │ └── whinc │ │ │ └── apksignaturedigest │ │ │ └── ApplicationTest.java │ └── build.gradle ├── .gitignore ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── gradle.properties ├── gradlew.bat └── gradlew ├── Screenshot.png ├── download_qrcode.png ├── README.md └── LICENSE /ApkSignatureDigest/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whinc/apk-signature-digest/HEAD/Screenshot.png -------------------------------------------------------------------------------- /download_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whinc/apk-signature-digest/HEAD/download_qrcode.png -------------------------------------------------------------------------------- /ApkSignatureDigest/app/app-release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whinc/apk-signature-digest/HEAD/ApkSignatureDigest/app/app-release.apk -------------------------------------------------------------------------------- /ApkSignatureDigest/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | .idea 4 | build 5 | */build 6 | *.iml 7 | *.pro 8 | .DS_Store 9 | /build 10 | /captures 11 | -------------------------------------------------------------------------------- /ApkSignatureDigest/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whinc/apk-signature-digest/HEAD/ApkSignatureDigest/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whinc/apk-signature-digest/HEAD/ApkSignatureDigest/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whinc/apk-signature-digest/HEAD/ApkSignatureDigest/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whinc/apk-signature-digest/HEAD/ApkSignatureDigest/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whinc/apk-signature-digest/HEAD/ApkSignatureDigest/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ApkSignatureDigest 3 | Result 4 | 5 | -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFF 4 | #F000 5 | #9c0 6 | #690 7 | -------------------------------------------------------------------------------- /ApkSignatureDigest/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # apk-signature-digest 2 | Get installed apk signature digest. 获取已安装的APK的签名摘要,现在有些第三方平台提交应用需要填写签名摘要,这个App就是这样一个工具. 3 | 4 | ![screenshot](./Screenshot.png) 5 | 6 | [Apk下载地址](https://github.com/whinc/apk-signature-digest/raw/master/ApkSignatureDigest/app/app-release.apk) 7 | 8 | ![Download URL](./download_qrcode.png) 9 | -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/drawable/btn_get_sign.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/androidTest/java/com/whinc/apksignaturedigest/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.whinc.apksignaturedigest; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /ApkSignatureDigest/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ApkSignatureDigest/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.whinc.apksignaturedigest" 9 | minSdkVersion 14 10 | targetSdkVersion 21 11 | versionCode 2 12 | versionName "1.0.1" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:23.0.1' 25 | compile 'com.jakewharton:butterknife:7.0.1' 26 | compile 'com.whinc.util:androidtoolkit:0.1.6' 27 | compile 'com.rengwuxian.materialedittext:library:2.1.4' 28 | } 29 | -------------------------------------------------------------------------------- /ApkSignatureDigest/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/java/com/whinc/apksignaturedigest/PackageUtils.java: -------------------------------------------------------------------------------- 1 | package com.whinc.apksignaturedigest; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageInfo; 5 | import android.content.pm.PackageManager; 6 | import android.content.pm.Signature; 7 | import android.support.annotation.NonNull; 8 | 9 | import java.security.MessageDigest; 10 | import java.security.NoSuchAlgorithmException; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by wuhui on 8/31/15. 15 | */ 16 | public class PackageUtils { 17 | private static final PackageUtils sSingleton = new PackageUtils(); 18 | private static final char[] HEX_CHAR = { 19 | '0', '1', '2', '3', '4', '5', '6', '7', 20 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 21 | }; 22 | 23 | private PackageUtils() {} 24 | 25 | public static PackageUtils getInstance() { 26 | return sSingleton; 27 | } 28 | 29 | /** 30 | *

Get the PackageInfo of specified package.

31 | * @param context 32 | * @param pkgName the package name 33 | * @return 34 | * @throws PackageManager.NameNotFoundException 35 | */ 36 | public PackageInfo getPackageInfo(@NonNull Context context, @NonNull String pkgName) throws PackageManager.NameNotFoundException { 37 | return context.getPackageManager().getPackageInfo(pkgName, 0); 38 | } 39 | 40 | /** 获取签名的MD5摘要 */ 41 | public String getSignatureDigest(@NonNull PackageInfo pkgInfo) { 42 | int length = pkgInfo.signatures.length; 43 | if (length <= 0) { 44 | return ""; 45 | } 46 | 47 | Signature signature = pkgInfo.signatures[0]; 48 | MessageDigest md5 = null; 49 | try { 50 | md5 = MessageDigest.getInstance("MD5"); 51 | } catch (NoSuchAlgorithmException e) { 52 | e.printStackTrace(); 53 | // Should not occur 54 | } 55 | byte[] digest = md5.digest(signature.toByteArray()); // get digest with md5 algorithm 56 | return toHexString(digest); 57 | } 58 | 59 | /** 将字节数组转化为对应的十六进制字符串 */ 60 | private String toHexString(byte[] rawByteArray) { 61 | char[] chars = new char[rawByteArray.length * 2]; 62 | for (int i = 0; i < rawByteArray.length; ++i) { 63 | byte b = rawByteArray[i]; 64 | chars[i*2] = HEX_CHAR[(b >>> 4 & 0x0F)]; 65 | chars[i*2+1] = HEX_CHAR[(b & 0x0F)]; 66 | } 67 | return new String(chars); 68 | } 69 | 70 | public List getInstalledPackages(@NonNull Context context) { 71 | return context.getPackageManager().getInstalledPackages(PackageManager.GET_SIGNATURES); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /ApkSignatureDigest/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /ApkSignatureDigest/app/src/main/res/layout/activity_apk_signature.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 22 |