diff --git a/README.md b/README.md new file mode 100644 index 0000000..dfc107b --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# JavaCard Hardware Wallet + +Currently just a skeleton for the hardware wallet. + +The .gpshell files are meant to be fed to GPShell. The statuswallet_install.gpshell file is actually dependent on the +target hw. Currently it assumes that the default VISA AID and keys for the ISD are used, but the version number is 2. + +Other files will come and go until they are formalized as test scripts when we have a meaningful specification +and implementation. + +The project is built using Gradle with the [Fidesmo Javacard Gradle plugin](https://github.com/fidesmo/gradle-javacard). \ No newline at end of file diff --git a/scripts/statuswallet_install.gpshell b/scripts/statuswallet_install.gpshell new file mode 100644 index 0000000..5cdb4d8 --- /dev/null +++ b/scripts/statuswallet_install.gpshell @@ -0,0 +1,10 @@ +mode_211 +enable_trace +establish_context +card_connect +select -AID A000000003000000 +open_sc -security 1 -keyind 0 -keyver 2 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4d4e4f +send_apdu_nostop -sc 1 -APDU 80E400800E4F0C53746174757357616C6C6574 +install -file ../build/javacard/im/status/wallet/javacard/wallet.cap -AID 53746174757357616C6C6574417070 -instAID 53746174757357616C6C6574417070 +card_disconnect +release_context \ No newline at end of file diff --git a/scripts/statuswallet_smoketest.gpshell b/scripts/statuswallet_smoketest.gpshell new file mode 100644 index 0000000..11f7fb7 --- /dev/null +++ b/scripts/statuswallet_smoketest.gpshell @@ -0,0 +1,8 @@ +mode_211 +enable_trace +establish_context +card_connect +select -AID 53746174757357616C6C6574417070 +send_apdu_nostop -APDU 80AA008000 +card_disconnect +release_context \ No newline at end of file diff --git a/src/main/java/im/status/wallet/WalletApplet.java b/src/main/java/im/status/wallet/WalletApplet.java index 5417d7c..c120fcc 100644 --- a/src/main/java/im/status/wallet/WalletApplet.java +++ b/src/main/java/im/status/wallet/WalletApplet.java @@ -15,6 +15,11 @@ public class WalletApplet extends Applet { } public void process(APDU apdu) throws ISOException { + if (selectingApplet()) { + apdu.setIncomingAndReceive(); + return; + } + ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); } }