Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted from Eclipse to Android Studio 3.0.1 #1

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .classpath

This file was deleted.

117 changes: 114 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,114 @@
/assets
/bin
/gen

# Created by https://www.gitignore.io/api/androidstudio

### AndroidStudio ###
# Covers files to be ignored for android development using Android Studio.

# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle
.gradle/
build/

# Signing files
.signing/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio
/*/build/
/*/local.properties
/*/out
/*/*/build
/*/*/production
captures/
.navigation/
*.ipr
*~
*.swp

# Android Patch
gen-external-apklibs

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# NDK
obj/

# IntelliJ IDEA
*.iml
*.iws
/out/

# https://stackoverflow.com/questions/26336709/android-studio-should-the-entire-idea-directory-be-in-git-ignore
.idea

# Keystore files
*.jks

# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Legacy Eclipse project files
.classpath
.project

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
hs_err_pid*

## Plugin-specific files:


# JIRA plugin
atlassian-ide-plugin.xml


# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### AndroidStudio Patch ###
# Google Services plugin
google-services.json

!/gradle/wrapper/gradle-wrapper.jar

# End of https://www.gitignore.io/api/androidstudio
33 changes: 0 additions & 33 deletions .project

This file was deleted.

21 changes: 21 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Giesecke Devrient GmbH:Open Mobile API:21'
buildToolsVersion '27.0.3'

defaultConfig {
applicationId "com.gieseckedevrient.android.hellosmartcard"
minSdkVersion 4
targetSdkVersion 15
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
}
1 change: 1 addition & 0 deletions app/release/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0.1-SNAPSHOT","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.gieseckedevrient.android.hellosmartcard;

import android.util.Log;

import nl.mansoft.openmobileapi.util.CommandApdu;
import nl.mansoft.openmobileapi.util.ResponseApdu;

import java.io.IOException;

public class Eduroam {
private final String TAG = Eduroam.class.getSimpleName();
public final static int OFFSET_USER = 0x00;
public final static int OFFSET_PASSWORD = 0x20;
private SmartcardIO mSmartcardIO;

public Eduroam(SmartcardIO smartcardIO) {
mSmartcardIO = smartcardIO;
}

public ResponseApdu selectEduroam() throws IOException {
CommandApdu c = new CommandApdu((byte)0x00, (byte)0xA4, (byte)0x00, (byte)0x00, new byte[] { 0x10, 0x00 });
return mSmartcardIO.runAPDU(c);
}

public ResponseApdu readEduroam() throws IOException {
ResponseApdu result = selectEduroam();
if (result.isSuccess()) {
Log.d(TAG, "reading eduroam");
CommandApdu c = new CommandApdu((byte)0x00, (byte)0xB0, (byte)0x00, (byte)0x00);
result = mSmartcardIO.runAPDU(c);
}
return result;
}

public boolean updateEduroam(byte[] data) throws IOException {
boolean result = false;
if (selectEduroam() != null) {
Log.d(TAG, "updating eduroam");
CommandApdu c = new CommandApdu((byte)0x00, (byte)0xD6, (byte)0x00, (byte)0x00, data);
result = mSmartcardIO.runAPDU(c) != null;
}
return result;
}

public static String readStringFromByteArray(byte[] barr, int offset) {
String result = "";
byte b;
int i = offset;
while ((b = barr[i++]) != (byte) 0xFF) {
result += (char) b;
}
return result;
}

}
Loading