ACardEmulator: added GIDS Applet

http://www.mysmartlogon.com/generic-identity-device-specification-gids-smart-card/
This commit is contained in:
Frank Morgner
2016-02-09 17:59:41 +01:00
parent 74f15ae9ef
commit 3fe38b0e6d
7 changed files with 34 additions and 2 deletions

View File

@@ -55,6 +55,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/external/GidsApplet/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/external/IsoApplet/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/external/android-scio/src/main" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/external/ykneo-openpgp/applet/src" isTestSource="false" />
@@ -70,14 +71,18 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debug" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>

View File

@@ -18,6 +18,8 @@ android {
}
}
sourceSets {
main.java.srcDirs += 'src/main/external/GidsApplet/src'
main.java.exclude('**/gidsAppletTests/*.java')
main.java.srcDirs += 'src/main/external/IsoApplet/src'
main.java.srcDirs += 'src/main/external/android-scio/src/main'
main.java.srcDirs += 'src/main/external/ykneo-openpgp/applet/src'

View File

@@ -31,8 +31,6 @@ import com.licel.jcardsim.base.SimulatorRuntime;
import com.licel.jcardsim.samples.HelloWorldApplet;
import com.licel.jcardsim.utils.AIDUtil;
import net.pwendland.javacard.pki.isoapplet.IsoApplet;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -41,6 +39,8 @@ import java.net.Socket;
import openpgpcard.OpenPGPApplet;
import pkgYkneoOath.YkneoOath;
import net.pwendland.javacard.pki.isoapplet.IsoApplet;
import com.mysmartlogon.gidsApplet.GidsApplet;
public class SimulatorService extends HostApduService {
@@ -114,6 +114,16 @@ public class SimulatorService extends HostApduService {
extra_error += "\n" + "Could not install " + name + " (AID: " + aid + ")";
}
name = getResources().getString(R.string.applet_gidsapplet);
aid = getResources().getString(R.string.aid_gidsapplet);
try {
simulator.installApplet(AIDUtil.create(aid), GidsApplet.class);
extra_install += "\n" + name + " (AID: " + aid + ")";
} catch (Exception e) {
e.printStackTrace();
extra_error += "\n" + "Could not install " + name + " (AID: " + aid + ")";
}
Intent i = new Intent(TAG);
if (!extra_error.isEmpty())
i.putExtra(EXTRA_ERROR, extra_error);

View File

@@ -14,6 +14,10 @@
<string name="action_delete">Clear Log</string>
<string name="action_help">Show Help</string>
<string name="aid_gidsapplet">A000000397425446590201</string>
<string name="aid_gidsapplet_truncated1">A0000003974254465902</string>
<string name="aid_gidsapplet_truncated2">A00000039742544659</string>
<string name="applet_gidsapplet">My Smart Logon\'s GIDS Applet</string>
<string name="aid_isoapplet">F276A288BCFBA69D34F31001</string>
<string name="applet_isoapplet">Philip Wendland\'s ISO Applet</string>
<string name="aid_helloworld">F000000001</string>
@@ -30,6 +34,7 @@
<b>OpenPGP Applet</b> <small>(AID D2760001240102000000000000010000)</small>\n
<b>OATH Applet</b> <small>(AID A000000527210101)</small>\n
<b>ISO Applet</b> <small>(AID F276A288BCFBA69D34F31001)</small>\n
<b>GIDS Applet</b> <small>(AID A000000397425446590201)</small>\n
\n
Place your device on a contact-less reader. When the reader issues a SELECT command for one of the application identifiers above, the emulator creates the appropriate applet. The emulated applet will then handle all subsequent APDUs.</string>

View File

@@ -21,4 +21,10 @@
<aid-filter android:name="@string/aid_isoapplet"/>
</aid-group>
<aid-group android:description="@string/applet_gidsapplet" android:category="other">
<aid-filter android:name="@string/aid_gidsapplet"/>
<aid-filter android:name="@string/aid_gidsapplet_truncated1"/>
<aid-filter android:name="@string/aid_gidsapplet_truncated2"/>
</aid-group>
</host-apdu-service>