├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── screenshot_20170920_181656.png │ │ │ │ ├── screenshot_20170920_181704.png │ │ │ │ └── screenshot_20170920_181748.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ └── layout │ │ │ │ ├── activity_regist_success.xml │ │ │ │ └── activity_regist.xml │ │ ├── aidl │ │ │ └── com │ │ │ │ └── jdnew │ │ │ │ └── serverapp │ │ │ │ └── aidl │ │ │ │ ├── RootLicenseData.aidl │ │ │ │ └── ILicense.aidl │ │ ├── java │ │ │ ├── license │ │ │ │ └── szca │ │ │ │ │ └── com │ │ │ │ │ └── licenseapp │ │ │ │ │ ├── presenter │ │ │ │ │ ├── CheckLicensePresenter.java │ │ │ │ │ ├── RegistPresenter1.java │ │ │ │ │ └── RegistPresenter.java │ │ │ │ │ ├── common │ │ │ │ │ └── Constant.java │ │ │ │ │ ├── util │ │ │ │ │ └── EditTextListener.java │ │ │ │ │ ├── activity │ │ │ │ │ ├── RegistSuccessActivity.java │ │ │ │ │ ├── RegistActivity.java │ │ │ │ │ └── RegistActivity1.java │ │ │ │ │ ├── view │ │ │ │ │ ├── IRegistView.java │ │ │ │ │ └── IRegistView1.java │ │ │ │ │ └── service │ │ │ │ │ └── BackService.java │ │ │ └── com │ │ │ │ └── jdnew │ │ │ │ └── serverapp │ │ │ │ └── aidl │ │ │ │ └── RootLicenseData.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── license │ │ │ └── szca │ │ │ └── com │ │ │ └── licenseapp │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── license │ │ └── szca │ │ └── com │ │ └── licenseapp │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── serverapp ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── aidl │ │ │ └── com │ │ │ │ └── jdnew │ │ │ │ └── serverapp │ │ │ │ └── aidl │ │ │ │ ├── RootLicenseData.aidl │ │ │ │ └── ILicense.aidl │ │ ├── java │ │ │ └── com │ │ │ │ └── jdnew │ │ │ │ └── serverapp │ │ │ │ ├── activity │ │ │ │ └── MainActivity.java │ │ │ │ ├── aidl │ │ │ │ └── RootLicenseData.java │ │ │ │ └── service │ │ │ │ └── LicenseService.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── jdnew │ │ │ └── serverapp │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── jdnew │ │ └── serverapp │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── licensekeylibrary ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── license │ │ │ └── szca │ │ │ └── com │ │ │ └── licensekeylibrary │ │ │ ├── CodeUtil.java │ │ │ ├── SHAUtil.java │ │ │ ├── RootData.java │ │ │ ├── RootSubmitData.java │ │ │ ├── GetDeviceInfoUtil.java │ │ │ ├── AESUtil.java │ │ │ ├── GenLicenseKeyUtil.java │ │ │ └── RSAUtil.java │ ├── test │ │ └── java │ │ │ └── license │ │ │ └── szca │ │ │ └── com │ │ │ └── licensekeylibrary │ │ │ ├── ExampleUnitTest.java │ │ │ ├── SHATest.java │ │ │ ├── LicenseTest.java │ │ │ ├── RSATest.java │ │ │ └── AESTest.java │ └── androidTest │ │ └── java │ │ └── license │ │ └── szca │ │ └── com │ │ └── licensekeylibrary │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── copyright │ └── profiles_settings.xml ├── markdown-navigator │ └── profiles_settings.xml ├── runConfigurations.xml ├── modules.xml ├── compiler.xml ├── gradle.xml └── misc.xml ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | .idea -------------------------------------------------------------------------------- /serverapp/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /licensekeylibrary/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | .idea -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':licensekeylibrary', ':serverapp' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | .idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | -------------------------------------------------------------------------------- /serverapp/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ServerApp 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /licensekeylibrary/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | LicenseKeyLibrary 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/screenshot_20170920_181656.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-xhdpi/screenshot_20170920_181656.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/screenshot_20170920_181704.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-xhdpi/screenshot_20170920_181704.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/screenshot_20170920_181748.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/app/src/main/res/mipmap-xhdpi/screenshot_20170920_181748.png -------------------------------------------------------------------------------- /serverapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JDChi/LicenseApp/HEAD/serverapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/aidl/com/jdnew/serverapp/aidl/RootLicenseData.aidl: -------------------------------------------------------------------------------- 1 | // RootLicenseData.aidl 2 | package com.jdnew.serverapp.aidl; 3 | 4 | // Declare any non-default types here with import statements 5 | 6 | parcelable RootLicenseData; 7 | -------------------------------------------------------------------------------- /serverapp/src/main/aidl/com/jdnew/serverapp/aidl/RootLicenseData.aidl: -------------------------------------------------------------------------------- 1 | // RootLicenseData.aidl 2 | package com.jdnew.serverapp.aidl; 3 | 4 | // Declare any non-default types here with import statements 5 | 6 | parcelable RootLicenseData; 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /serverapp/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/license/szca/com/licenseapp/presenter/CheckLicensePresenter.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licenseapp.presenter; 2 | 3 | /** 4 | * description 5 | * Created by JD 6 | * on 2017/9/18. 7 | */ 8 | 9 | public class CheckLicensePresenter { 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 12 09:09:10 CST 2017 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-3.3-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/license/szca/com/licenseapp/common/Constant.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licenseapp.common; 2 | 3 | /** 4 | * description 5 | * Created by JD 6 | * on 2017/9/20. 7 | */ 8 | 9 | public class Constant { 10 | 11 | public static final int MSG_GET_LICENSE = 1; 12 | public static final int MSG_CHECK_LICENSE = 2; 13 | } 14 | -------------------------------------------------------------------------------- /licensekeylibrary/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/aidl/com/jdnew/serverapp/aidl/ILicense.aidl: -------------------------------------------------------------------------------- 1 | // ILicense.aidl 2 | package com.jdnew.serverapp.aidl; 3 | 4 | // Declare any non-default types here with import statements 5 | import com.jdnew.serverapp.aidl.RootLicenseData; 6 | 7 | 8 | 9 | 10 | interface ILicense { 11 | 12 | RootLicenseData returnLicense(String licenseData); 13 | 14 | String returnCheckResult(String submitData); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /serverapp/src/main/aidl/com/jdnew/serverapp/aidl/ILicense.aidl: -------------------------------------------------------------------------------- 1 | // ILicense.aidl 2 | package com.jdnew.serverapp.aidl; 3 | 4 | // Declare any non-default types here with import statements 5 | import com.jdnew.serverapp.aidl.RootLicenseData; 6 | 7 | 8 | 9 | 10 | interface ILicense { 11 | 12 | RootLicenseData returnLicense(String licenseData); 13 | 14 | String returnCheckResult(String submitData); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /licensekeylibrary/src/test/java/license/szca/com/licensekeylibrary/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | /** 4 | * Example local unit test, which will execute on the development machine (host). 5 | * 6 | * @see Testing documentation 7 | */ 8 | public class ExampleUnitTest { 9 | 10 | 11 | 12 | public void init(){ 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /serverapp/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /serverapp/src/main/java/com/jdnew/serverapp/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.jdnew.serverapp.activity; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | import com.jdnew.serverapp.R; 7 | 8 | public class MainActivity extends AppCompatActivity { 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.activity_main); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /serverapp/src/test/java/com/jdnew/serverapp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.jdnew.serverapp; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/test/java/license/szca/com/licenseapp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licenseapp; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_regist_success.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /licensekeylibrary/src/main/java/license/szca/com/licensekeylibrary/CodeUtil.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | import org.spongycastle.util.encoders.Hex; 4 | 5 | /** 6 | * description : 编码工具类 7 | * author : JDNew 8 | * on : 2017/9/17. 9 | */ 10 | 11 | public class CodeUtil { 12 | 13 | /** 14 | * 十六进制编码 15 | * @param data 16 | * @return 17 | */ 18 | public String hexData(byte[] data) { 19 | // String hexResult = new String(Hex.encode(data)); 20 | // return hexResult; 21 | return new String(Hex.encode(data)).toUpperCase(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/license/szca/com/licenseapp/util/EditTextListener.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licenseapp.util; 2 | 3 | import android.text.Editable; 4 | import android.text.TextWatcher; 5 | 6 | /** 7 | * description 8 | * Created by JD 9 | * on 2017/9/15. 10 | */ 11 | 12 | public class EditTextListener implements TextWatcher { 13 | @Override 14 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 15 | 16 | } 17 | 18 | @Override 19 | public void onTextChanged(CharSequence s, int start, int before, int count) { 20 | 21 | } 22 | 23 | @Override 24 | public void afterTextChanged(Editable s) { 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/license/szca/com/licenseapp/activity/RegistSuccessActivity.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licenseapp.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | import license.szca.com.licenseapp.R; 8 | 9 | /** 10 | * description : 注册成功页面 11 | * author : JDNew 12 | * on : 2017/9/17. 13 | */ 14 | 15 | public class RegistSuccessActivity extends AppCompatActivity { 16 | 17 | @Override 18 | protected void onCreate(@Nullable Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_regist_success); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /licensekeylibrary/src/test/java/license/szca/com/licensekeylibrary/SHATest.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | import org.junit.Before; 4 | import org.junit.Test; 5 | 6 | import static org.junit.Assert.assertEquals; 7 | 8 | /** 9 | * description 10 | * Created by JD 11 | * on 2017/9/18. 12 | */ 13 | 14 | public class SHATest { 15 | 16 | SHAUtil shaUtil; 17 | CodeUtil codeUtil; 18 | String originData = "abc"; 19 | @Before 20 | public void init(){ 21 | shaUtil = new SHAUtil(); 22 | codeUtil = new CodeUtil(); 23 | } 24 | 25 | @Test 26 | public void shaTest(){ 27 | assertEquals(codeUtil.hexData(shaUtil.encodeSHA1(originData.getBytes())) , codeUtil.hexData(shaUtil.encodeSHA1(originData.getBytes()))); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /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 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/main/java/license/szca/com/licenseapp/view/IRegistView.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licenseapp.view; 2 | 3 | /** 4 | * description 5 | * Created by JD 6 | * on 2017/9/12. 7 | */ 8 | 9 | public interface IRegistView { 10 | /** 11 | * 获取证书失败 12 | * @param msg 13 | */ 14 | void getLicenseKeyFailed(String msg); 15 | 16 | /** 17 | * 获取证书成功 18 | * @param key 19 | */ 20 | void getLicenseKeySuccess(String key); 21 | 22 | /** 23 | * 证书校验成功 24 | * @param msg 25 | */ 26 | void checkLicenseKeySuccess(String msg); 27 | 28 | /** 29 | * 证书校验失败 30 | * @param msg 31 | */ 32 | void checkLicenseKeyFailed(String msg); 33 | 34 | /** 35 | * 加载中 36 | * @param msg 37 | */ 38 | void showLoading(String msg); 39 | } 40 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/license/szca/com/licenseapp/view/IRegistView1.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licenseapp.view; 2 | 3 | /** 4 | * description : 5 | * author : JDNew 6 | * on : 2017/9/24. 7 | */ 8 | 9 | public interface IRegistView1 { 10 | 11 | /** 12 | * 获取证书失败 13 | * @param msg 14 | */ 15 | void getLicenseKeyFailed(String msg); 16 | 17 | /** 18 | * 获取证书成功 19 | * @param key 20 | */ 21 | void getLicenseKeySuccess(String key); 22 | 23 | /** 24 | * 证书校验成功 25 | * @param msg 26 | */ 27 | void checkLicenseKeySuccess(String msg); 28 | 29 | /** 30 | * 证书校验失败 31 | * @param msg 32 | */ 33 | void checkLicenseKeyFailed(String msg); 34 | 35 | /** 36 | * 加载中 37 | * @param msg 38 | */ 39 | void showLoading(String msg); 40 | } 41 | -------------------------------------------------------------------------------- /licensekeylibrary/src/test/java/license/szca/com/licensekeylibrary/LicenseTest.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | /** 10 | * description 生成的20位license的测试类 11 | * Created by JD 12 | * on 2017/9/14. 13 | */ 14 | 15 | public class LicenseTest { 16 | 17 | private String testData = "hello"; 18 | private Context mContext; 19 | private GenLicenseKeyUtil genLicenseKeyUtil; 20 | 21 | @Before 22 | public void init(){ 23 | 24 | 25 | mContext = InstrumentationRegistry.getContext(); 26 | genLicenseKeyUtil = new GenLicenseKeyUtil(mContext); 27 | } 28 | 29 | @Test 30 | public void shaTest(){ 31 | 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | LicenseApp 3 | 4 | 5 | Email 6 | Password (optional) 7 | Sign in or register 8 | Sign in 9 | This email address is invalid 10 | This password is too short 11 | This password is incorrect 12 | This field is required 13 | "Contacts permissions are needed for providing email 14 | completions." 15 | 16 | 17 | -------------------------------------------------------------------------------- /serverapp/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /serverapp/src/androidTest/java/com/jdnew/serverapp/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.jdnew.serverapp; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.jdnew.serverapp", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/androidTest/java/license/szca/com/licenseapp/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licenseapp; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("license.szca.com.licenseapp", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /licensekeylibrary/src/androidTest/java/license/szca/com/licensekeylibrary/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("license.szca.com.licensekeylibrary.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /licensekeylibrary/src/test/java/license/szca/com/licensekeylibrary/RSATest.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | import org.junit.Before; 4 | import org.junit.Test; 5 | 6 | import static org.junit.Assert.assertEquals; 7 | 8 | /** 9 | * description : RSA测试类 10 | * author : JDNew 11 | * on : 2017/9/17. 12 | */ 13 | 14 | public class RSATest { 15 | 16 | 17 | private RSAUtil rsaUtil; 18 | private String originData = "abc"; 19 | 20 | @Before 21 | public void init() { 22 | rsaUtil = new RSAUtil(); 23 | //初始化生成公钥和密钥 24 | rsaUtil.initPrivateAndPublicKey(); 25 | } 26 | 27 | @Test 28 | public void rsaTest() { 29 | //私钥加密 30 | byte[] encryptData = rsaUtil.encryptWithPrivateKey(originData.getBytes(), rsaUtil.getPrivateKey()); 31 | //公钥解密 32 | byte[] decryptData = rsaUtil.decryptWithPublicKey(encryptData, rsaUtil.getPublicKey()); 33 | 34 | assertEquals(originData, new String(decryptData)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\edao\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /serverapp/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\installation\Android\Android\androidsdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /licensekeylibrary/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\edao\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /serverapp/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | buildToolsVersion "26.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.jdnew.serverapp" 9 | minSdkVersion 21 10 | targetSdkVersion 26 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | compile fileTree(include: ['*.jar'], dir: 'libs') 27 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 28 | exclude group: 'com.android.support', module: 'support-annotations' 29 | }) 30 | compile 'com.android.support:appcompat-v7:26.+' 31 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 32 | testCompile 'junit:junit:4.12' 33 | compile project(':licensekeylibrary') 34 | } 35 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | signingConfigs { 5 | 6 | } 7 | compileSdkVersion 25 8 | buildToolsVersion "25.0.0" 9 | defaultConfig { 10 | applicationId "license.szca.com.licenseapp" 11 | minSdkVersion 14 12 | targetSdkVersion 25 13 | versionCode 1 14 | versionName "1.0" 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | compile fileTree(include: ['*.jar'], dir: 'libs') 27 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 28 | exclude group: 'com.android.support', module: 'support-annotations' 29 | }) 30 | compile 'com.android.support:appcompat-v7:25.+' 31 | compile 'com.android.support:design:25.+' 32 | testCompile 'junit:junit:4.12' 33 | compile project(':licensekeylibrary') 34 | } 35 | -------------------------------------------------------------------------------- /licensekeylibrary/src/main/java/license/szca/com/licensekeylibrary/SHAUtil.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | import java.security.Security; 6 | 7 | /** 8 | * description : SHA消息摘要工具类 9 | * author : JDNew 10 | * on : 2017/9/17. 11 | */ 12 | 13 | public class SHAUtil { 14 | static { 15 | //从位置1开始,添加新的提供者 16 | Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); 17 | } 18 | /** 19 | * 使用SHA1进行消息摘要 20 | * 21 | * @param data 22 | * @return 23 | */ 24 | public byte[] encodeSHA1(byte[] data) { 25 | byte[] dataByte = null; 26 | byte[] newDataByte = null; 27 | try { 28 | MessageDigest messageDigest = MessageDigest.getInstance("SHA"); 29 | dataByte = messageDigest.digest(data); 30 | //摘要后截取后10位返回 31 | newDataByte = new byte[10]; 32 | System.arraycopy(dataByte, 9, newDataByte, 0, 10); 33 | } catch (NoSuchAlgorithmException e) { 34 | e.printStackTrace(); 35 | } 36 | 37 | return newDataByte; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /serverapp/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /licensekeylibrary/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.0" 6 | 7 | defaultConfig { 8 | minSdkVersion 14 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | compile fileTree(include: ['*.jar'], dir: 'libs') 26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 27 | exclude group: 'com.android.support', module: 'support-annotations' 28 | }) 29 | compile 'com.android.support:appcompat-v7:25.+' 30 | testCompile 'junit:junit:4.12' 31 | compile 'com.madgag.spongycastle:core:1.58.0.0' 32 | compile 'com.madgag.spongycastle:prov:1.58.0.0' 33 | compile 'com.madgag.spongycastle:pkix:1.54.0.0' 34 | compile 'com.madgag.spongycastle:pg:1.54.0.0' 35 | compile 'com.android.support.test:runner:0.5' 36 | compile 'com.google.code.gson:gson:2.8.1' 37 | } 38 | -------------------------------------------------------------------------------- /licensekeylibrary/src/main/java/license/szca/com/licensekeylibrary/RootData.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | /** 4 | * description : 客户端数据的实体类 5 | * author : JDNew 6 | * on : 2017/9/17. 7 | */ 8 | 9 | public class RootData { 10 | private String userName; 11 | private String uuid; 12 | private String applicationId; 13 | private String licenseKey; 14 | private String appSignture; 15 | 16 | 17 | 18 | 19 | public void setUuid(String uuid) { 20 | this.uuid = uuid; 21 | } 22 | 23 | public String getUuid() { 24 | return uuid; 25 | } 26 | 27 | public void setApplicationId(String applicationId) { 28 | this.applicationId = applicationId; 29 | } 30 | 31 | public String getApplicationId() { 32 | return applicationId; 33 | } 34 | 35 | public void setUserName(String userName) { 36 | this.userName = userName; 37 | } 38 | 39 | public String getUserName() { 40 | return userName; 41 | } 42 | 43 | public String getAppSignture() { 44 | return appSignture; 45 | } 46 | 47 | public void setAppSignture(String appSignture) { 48 | this.appSignture = appSignture; 49 | } 50 | 51 | public String getLicenseKey() { 52 | return licenseKey; 53 | } 54 | 55 | public void setLicenseKey(String licenseKey) { 56 | this.licenseKey = licenseKey; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /licensekeylibrary/src/main/java/license/szca/com/licensekeylibrary/RootSubmitData.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | /** 4 | * description 提交给客户端的数据实体类 5 | * Created by JD 6 | * on 2017/9/18. 7 | */ 8 | 9 | public class RootSubmitData { 10 | 11 | /** 12 | * AES密钥,用于解密出客户端数据 13 | */ 14 | private String encrptAESKey; 15 | /** 16 | * 被AES加密过的数据 17 | */ 18 | private String encryptAESClientData; 19 | /** 20 | * 签名后的数据 21 | */ 22 | private String signData; 23 | /** 24 | * RSA签名公钥 25 | */ 26 | private String rsaSignPublicKey; 27 | 28 | 29 | 30 | public String getEncrptAESKey() { 31 | return encrptAESKey; 32 | } 33 | 34 | public void setEncrptAESKey(String encrptAESKey) { 35 | this.encrptAESKey = encrptAESKey; 36 | } 37 | 38 | public String getEncryptAESClientData() { 39 | return encryptAESClientData; 40 | } 41 | 42 | public void setEncryptAESClientData(String encryptAESClientData) { 43 | this.encryptAESClientData = encryptAESClientData; 44 | } 45 | 46 | public String getSignData() { 47 | return signData; 48 | } 49 | 50 | public void setSignData(String signData) { 51 | this.signData = signData; 52 | } 53 | 54 | public String getRsaSignPublicKey() { 55 | return rsaSignPublicKey; 56 | } 57 | 58 | public void setRsaSignPublicKey(String rsaSignPublicKey) { 59 | this.rsaSignPublicKey = rsaSignPublicKey; 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /licensekeylibrary/src/test/java/license/szca/com/licensekeylibrary/AESTest.java: -------------------------------------------------------------------------------- 1 | package license.szca.com.licensekeylibrary; 2 | 3 | import org.junit.Before; 4 | import org.junit.Test; 5 | 6 | import static org.junit.Assert.assertEquals; 7 | 8 | /** 9 | * description : AES测试类 10 | * author : JDNew 11 | * on : 2017/9/17. 12 | */ 13 | 14 | public class AESTest { 15 | 16 | AESUtil aesUtil; 17 | //未加密数据 18 | String originData = "b8555645050517e860e0d09e8468a225159834bc9014e48b0d1572d7d18684241af9b8dc8c3d85416ce29e895f541c40554f33dd1a11ae0f4b62dbd6676f82c20758f28c4b750a05824284e76f770fb2d225fdbd48bcb6592095f657784bffcfd80e97ff101cf6f8f0e37815ee50cf46d7ad8481fcab5b8e0e294a16cbae33c4f5ddb80fb88f55273f2b14959f7bc56edbda56bf70c9ca8c88bf678929f1fed9039c8593455d41ee6ef9e25b1c99df3ee4f99be613ac077ca8197200f1833a42dfbe586c7307d2b1367089b8c5dce7312f5eae6418a5c8944fca99727ad87ca5fe823e11807e4616d464979263065f875a6cf669625f58dc3b320ac4383def899dfd3f5705af6413587acd3684cf5010f10b06d6d64131b8fa76ce2fcf5a01118010b26b6c90de8065bb31991a46d12c6baa6db9c729d1b74d2997a316b0daf6"; 19 | @Before 20 | public void init(){ 21 | aesUtil = new AESUtil(); 22 | } 23 | 24 | @Test 25 | public void aesTest(){ 26 | 27 | //aes加密 28 | byte[] encryptData = aesUtil.encryptData(originData.getBytes(), aesUtil.getAESSecretKey()); 29 | //aes解密 30 | byte[] decryptData = aesUtil.decryptData(encryptData , aesUtil.getAESSecretKey()); 31 | 32 | assertEquals(originData, new String(decryptData)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/jdnew/serverapp/aidl/RootLicenseData.java: -------------------------------------------------------------------------------- 1 | package com.jdnew.serverapp.aidl; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | /** 7 | * description : 8 | * author : JDNew 9 | * on : 2017/9/24. 10 | */ 11 | 12 | public class RootLicenseData implements Parcelable { 13 | 14 | private String license; 15 | private byte[] rsaPublicKey; 16 | 17 | public String getLicense() { 18 | return license; 19 | } 20 | 21 | public void setLicense(String license) { 22 | this.license = license; 23 | } 24 | 25 | public byte[] getRsaPublicKey() { 26 | return rsaPublicKey; 27 | } 28 | 29 | public void setRsaPublicKey(byte[] rsaPublicKey) { 30 | this.rsaPublicKey = rsaPublicKey; 31 | } 32 | 33 | public RootLicenseData(String license , byte[] rsaPublicKey){ 34 | this.license = license; 35 | this.rsaPublicKey = rsaPublicKey; 36 | } 37 | 38 | protected RootLicenseData(Parcel in) { 39 | license = in.readString(); 40 | rsaPublicKey = in.createByteArray(); 41 | } 42 | 43 | public static final Creator CREATOR = new Creator() { 44 | @Override 45 | public RootLicenseData createFromParcel(Parcel in) { 46 | return new RootLicenseData(in); 47 | } 48 | 49 | @Override 50 | public RootLicenseData[] newArray(int size) { 51 | return new RootLicenseData[size]; 52 | } 53 | }; 54 | 55 | @Override 56 | public int describeContents() { 57 | return 0; 58 | } 59 | 60 | @Override 61 | public void writeToParcel(Parcel parcel, int i) { 62 | parcel.writeString(license); 63 | parcel.writeByteArray(rsaPublicKey); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /serverapp/src/main/java/com/jdnew/serverapp/aidl/RootLicenseData.java: -------------------------------------------------------------------------------- 1 | package com.jdnew.serverapp.aidl; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | /** 7 | * description : 8 | * author : JDNew 9 | * on : 2017/9/24. 10 | */ 11 | 12 | public class RootLicenseData implements Parcelable { 13 | 14 | private String license; 15 | private byte[] rsaPublicKey; 16 | 17 | public String getLicense() { 18 | return license; 19 | } 20 | 21 | public void setLicense(String license) { 22 | this.license = license; 23 | } 24 | 25 | public byte[] getRsaPublicKey() { 26 | return rsaPublicKey; 27 | } 28 | 29 | public void setRsaPublicKey(byte[] rsaPublicKey) { 30 | this.rsaPublicKey = rsaPublicKey; 31 | } 32 | 33 | public RootLicenseData (String license , byte[] rsaPublicKey){ 34 | this.license = license; 35 | this.rsaPublicKey = rsaPublicKey; 36 | } 37 | 38 | protected RootLicenseData(Parcel in) { 39 | license = in.readString(); 40 | rsaPublicKey = in.createByteArray(); 41 | } 42 | 43 | public static final Creator CREATOR = new Creator() { 44 | @Override 45 | public RootLicenseData createFromParcel(Parcel in) { 46 | return new RootLicenseData(in); 47 | } 48 | 49 | @Override 50 | public RootLicenseData[] newArray(int size) { 51 | return new RootLicenseData[size]; 52 | } 53 | }; 54 | 55 | @Override 56 | public int describeContents() { 57 | return 0; 58 | } 59 | 60 | @Override 61 | public void writeToParcel(Parcel parcel, int i) { 62 | parcel.writeString(license); 63 | parcel.writeByteArray(rsaPublicKey); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_regist.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 18 | 19 | 20 |