Integrated PIV applet

https://github.com/arekinath/PivApplet
This commit is contained in:
Frank Morgner
2019-09-09 15:17:01 +02:00
parent 6ec798d509
commit 75779ea77a
11 changed files with 64 additions and 21 deletions

View File

@@ -185,6 +185,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
bindPreferenceSummaryToValue(findPreference("emulator"));
bindPreferenceSummaryToValue(findPreference("activate_helloworld"));
bindPreferenceSummaryToValue(findPreference("activate_pivapplet"));
bindPreferenceSummaryToValue(findPreference("activate_openpgp"));
bindPreferenceSummaryToValue(findPreference("activate_oath"));
bindPreferenceSummaryToValue(findPreference("activate_isoapplet"));

View File

@@ -85,6 +85,7 @@ public class EmulatorSingleton {
SP.getBoolean("activate_openpgp", false),
SP.getBoolean("activate_oath", false),
SP.getBoolean("activate_isoapplet", false),
SP.getBoolean("activate_pivapplet", false),
SP.getBoolean("activate_gidsapplet", false));
}
}

View File

@@ -13,6 +13,7 @@ import com.vsmartcard.acardemulator.R;
import com.vsmartcard.acardemulator.Util;
import net.pwendland.javacard.pki.isoapplet.IsoApplet;
import net.cooperi.pivapplet.PivApplet;
import openpgpcard.OpenPGPApplet;
import pkgYkneoOath.YkneoOath;
@@ -27,6 +28,7 @@ public class JCEmulator implements Emulator {
boolean activate_openpgp,
boolean activate_oath,
boolean activate_isoapplet,
boolean activate_pivapplet,
boolean activate_gidsapplet) {
String aid, name, extra_install = "", extra_error = "";
simulator = new Simulator(new SimulatorRuntime());
@@ -75,6 +77,18 @@ public class JCEmulator implements Emulator {
}
}
if (activate_pivapplet) {
name = context.getResources().getString(R.string.applet_pivapplet);
aid = context.getResources().getString(R.string.aid_pivapplet);
try {
simulator.installApplet(AIDUtil.create(aid), PivApplet.class);
extra_install += "\n" + name + " (AID: " + aid + ")";
} catch (Exception e) {
e.printStackTrace();
extra_error += "\n" + "Could not install " + name + " (AID: " + aid + ")";
}
}
if (activate_isoapplet) {
name = context.getResources().getString(R.string.applet_isoapplet);
aid = context.getResources().getString(R.string.aid_isoapplet);

View File

@@ -20,6 +20,12 @@
<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_pivapplet">A00000030800001000</string>
<string name="aid_pivapplet_truncated1">A000000308000010</string>
<string name="aid_pivapplet_truncated2">A0000003080000</string>
<string name="aid_pivapplet_truncated3">A00000030800</string>
<string name="aid_pivapplet_truncated4">A000000308</string>
<string name="applet_pivapplet">Alex Wilson\'s PIV Applet</string>
<string name="aid_helloworld">F000000001</string>
<string name="applet_helloworld">jCardSim Team\'s Hello World Applet</string>
<string name="aid_partial_openpgp">D27600012401</string>
@@ -33,6 +39,7 @@
<b>Hello World Applet</b> <small>(AID F000000001)</small>\n
<b>OpenPGP Applet</b> <small>(AID D2760001240102000000000000010000)</small>\n
<b>OATH Applet</b> <small>(AID A000000527210101)</small>\n
<b>PIV Applet</b> <small>(AID A00000030800001000)</small>\n
<b>ISO Applet</b> <small>(AID F276A288BCFBA69D34F31001)</small>\n
<b>GIDS Applet</b> <small>(AID A000000397425446590201)</small>\n
\n

View File

@@ -21,6 +21,14 @@
<aid-filter android:name="@string/aid_isoapplet"/>
</aid-group>
<aid-group android:description="@string/applet_pivapplet" android:category="other">
<aid-filter android:name="@string/aid_pivapplet"/>
<aid-filter android:name="@string/aid_pivapplet_truncated1"/>
<aid-filter android:name="@string/aid_pivapplet_truncated2"/>
<aid-filter android:name="@string/aid_pivapplet_truncated3"/>
<aid-filter android:name="@string/aid_pivapplet_truncated4"/>
</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"/>

View File

@@ -37,6 +37,12 @@
android:key="activate_isoapplet"
android:defaultValue="true"
/>
<SwitchPreference
android:title="@string/applet_pivapplet"
android:switchTextOn="@string/aid_pivapplet"
android:key="activate_pivapplet"
android:defaultValue="true"
/>
<SwitchPreference
android:title="@string/applet_gidsapplet"
android:switchTextOn="@string/aid_gidsapplet"