├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── fidesmo │ │ │ │ └── ble │ │ │ │ └── client │ │ │ │ ├── models │ │ │ │ ├── CardBatch.java │ │ │ │ ├── CardOperation.java │ │ │ │ ├── CardInfo.java │ │ │ │ └── Capabilities.java │ │ │ │ ├── Utils.java │ │ │ │ ├── BleCard.java │ │ │ │ ├── apdu │ │ │ │ └── CardInfoClient.java │ │ │ │ ├── MainActivity.java │ │ │ │ └── BlePeripheralService.java │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── com │ │ └── fidesmo │ │ └── ble │ │ └── ApplicationTest.java ├── lint.xml ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── images ├── NFC-traces.png ├── card-found.png ├── info-obtained.jpg └── scan-started.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── LICENSE ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /images/NFC-traces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/images/NFC-traces.png -------------------------------------------------------------------------------- /images/card-found.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/images/card-found.png -------------------------------------------------------------------------------- /images/info-obtained.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/images/info-obtained.jpg -------------------------------------------------------------------------------- /images/scan-started.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/images/scan-started.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | APDU over BLE demo application 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fidesmo/apdu-over-ble-android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Aug 14 12:55:06 CEST 2019 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-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.log 3 | 4 | # sbt specific 5 | .cache 6 | .history 7 | .lib/ 8 | dist/* 9 | target/ 10 | lib_managed/ 11 | src_managed/ 12 | project/boot/ 13 | project/plugins/project/ 14 | 15 | # Scala-IDE specific 16 | .scala_dependencies 17 | .worksheet 18 | *.iml 19 | .gradle 20 | /local.properties 21 | .DS_Store 22 | /build 23 | /.idea/ 24 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/fidesmo/ble/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.fidesmo.ble; 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 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/fidesmo/ble/client/models/CardBatch.java: -------------------------------------------------------------------------------- 1 | package com.fidesmo.ble.client.models; 2 | 3 | public class CardBatch { 4 | private final long issuer; 5 | private final int batchId; 6 | 7 | public CardBatch(long issuer, int batchId) { 8 | this.issuer = issuer; 9 | this.batchId = batchId; 10 | } 11 | 12 | public long getIssuer() { 13 | return issuer; 14 | } 15 | 16 | public int getBatchId() { 17 | return batchId; 18 | } 19 | 20 | @Override 21 | public String toString() { 22 | return "CardBatch{" + 23 | "issuer=" + issuer + 24 | ", batchId=" + batchId + 25 | '}'; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /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 /Users/sergeykhruschak/workspace/tools/android-sdk-macosx/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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /app/src/main/java/com/fidesmo/ble/client/models/CardOperation.java: -------------------------------------------------------------------------------- 1 | package com.fidesmo.ble.client.models; 2 | 3 | import com.fidesmo.ble.client.Utils; 4 | 5 | public class CardOperation { 6 | private final long id; 7 | private final byte[] request; 8 | private byte[] response; 9 | 10 | public CardOperation(long id, byte[] request) { 11 | this.id = id; 12 | this.request = request; 13 | } 14 | 15 | public long getId() { 16 | return id; 17 | } 18 | 19 | public byte[] getRequest() { 20 | return request; 21 | } 22 | 23 | public byte[] getResponse() { 24 | return response; 25 | } 26 | 27 | public void setResponse(byte[] response) { 28 | this.response = response; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return "CardOperation{" + 34 | "id=" + id + 35 | ", request=" + Utils.encodeHex(request) + 36 | ", response=" + (response != null ? Utils.encodeHex(response) : null) + 37 | '}'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Fidesmo AB 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/fidesmo/ble/client/models/CardInfo.java: -------------------------------------------------------------------------------- 1 | package com.fidesmo.ble.client.models; 2 | 3 | import java.util.Arrays; 4 | 5 | public class CardInfo { 6 | private final byte[] iin; 7 | private final byte[] cin; 8 | private final byte[] isdAid; 9 | private final CardBatch batch; 10 | private final Capabilities capabilities; 11 | 12 | public CardInfo(byte[] iin, byte[] cin, byte[] isdAid, CardBatch batch, Capabilities capabilities) { 13 | this.iin = iin; 14 | this.cin = cin; 15 | this.isdAid = isdAid; 16 | this.batch = batch; 17 | this.capabilities = capabilities; 18 | } 19 | 20 | public byte[] getIin() { 21 | return iin; 22 | } 23 | 24 | public byte[] getCin() { 25 | return cin; 26 | } 27 | 28 | public byte[] getIsdAid() { 29 | return isdAid; 30 | } 31 | 32 | public CardBatch getBatch() { 33 | return batch; 34 | } 35 | 36 | public Capabilities getCapabilities() { 37 | return capabilities; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "CardInfo{" + 43 | "iin=" + Arrays.toString(iin) + 44 | ", cin=" + Arrays.toString(cin) + 45 | ", isdAid=" + Arrays.toString(isdAid) + 46 | ", batch=" + batch + 47 | ", capabilities=" + capabilities + 48 | '}'; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion '28.0.3' 6 | 7 | defaultConfig { 8 | applicationId "com.fidesmo.ble.client" 9 | minSdkVersion 21 10 | targetSdkVersion 28 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | lintOptions { 22 | disable 'Registered' //Ugly fix #2: Travis checks for the registered activities pre-compilation. 23 | if (project.hasProperty('strictCheck')) { 24 | warningsAsErrors = strictCheck 25 | } 26 | textReport true 27 | } 28 | 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_1_8 31 | targetCompatibility JavaVersion.VERSION_1_8 32 | } 33 | } 34 | 35 | repositories { 36 | maven { 37 | url 'http://releases.marmeladburk.fidesmo.com' 38 | } 39 | maven { 40 | url "https://s3.amazonaws.com/repo.commonsware.com" 41 | } 42 | maven { 43 | url "http://dl.bintray.com/fidesmo/maven" 44 | } 45 | jcenter() 46 | } 47 | 48 | dependencies { 49 | implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) 50 | testImplementation 'junit:junit:4.12' 51 | implementation 'com.android.support:appcompat-v7:28.0.0' 52 | implementation 'io.reactivex:rxjava:1.0.13' 53 | implementation 'com.fidesmo:ble-client-android:0.1.24@aar' 54 | implementation 'com.fidesmo:nordpol-android:0.1.23@aar' 55 | implementation 'com.fidesmo:nordpol-core:0.1.23' 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 23 | 24 | 31 | 32 | 37 | 38 | 39 | 40 |