mirror of
https://github.com/status-im/status-keycard.git
synced 2025-01-21 11:08:57 +00:00
build the cash applet
This commit is contained in:
parent
09c725dcb2
commit
5e68adb79e
@ -57,7 +57,7 @@ dependencies {
|
||||
testCompile(files("../jcardsim/jcardsim-3.0.5-SNAPSHOT.jar"))
|
||||
testCompile('org.web3j:core:2.3.1')
|
||||
testCompile('org.bitcoinj:bitcoinj-core:0.14.5')
|
||||
testCompile('com.github.status-im.status-keycard-java:desktop:5771994')
|
||||
testCompile('com.github.status-im.status-keycard-java:desktop:8b73b6c')
|
||||
testCompile('org.bouncycastle:bcprov-jdk15on:1.60')
|
||||
testCompile("org.junit.jupiter:junit-jupiter-api:5.1.1")
|
||||
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.1.1")
|
||||
|
@ -4,5 +4,5 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.github.status-im.status-keycard-java:desktop:2.2.1'
|
||||
compile 'com.github.status-im.status-keycard-java:desktop:8b73b6c'
|
||||
}
|
@ -67,6 +67,8 @@ public class InstallTask extends DefaultTask {
|
||||
cmdSet.installKeycardApplet();
|
||||
logger.info("Installing the NDEF Applet");
|
||||
cmdSet.installNDEFApplet(new byte[0]);
|
||||
logger.info("Installing the Cash Applet");
|
||||
cmdSet.installCashApplet();
|
||||
} catch (IOException e) {
|
||||
throw new GradleException("I/O error", e);
|
||||
} catch (APDUException e) {
|
||||
|
@ -51,7 +51,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@DisplayName("Test the Keycard Applet")
|
||||
public class KeycardTest {
|
||||
// Psiring key is KeycardTest
|
||||
// Pairing key is KeycardTest
|
||||
private static CardTerminal cardTerminal;
|
||||
private static CardChannel apduChannel;
|
||||
private static im.status.keycard.io.CardChannel sdkChannel;
|
||||
@ -130,7 +130,13 @@ public class KeycardTest {
|
||||
private static void openSimulatorChannel() throws Exception {
|
||||
simulator = new CardSimulator();
|
||||
AID appletAID = AIDUtil.create(Identifiers.getKeycardInstanceAID());
|
||||
AID ndefAID = AIDUtil.create(Identifiers.NDEF_AID);
|
||||
AID cashAID = AIDUtil.create(Identifiers.CASH_AID);
|
||||
|
||||
simulator.installApplet(appletAID, KeycardApplet.class);
|
||||
simulator.installApplet(ndefAID, NDEFApplet.class);
|
||||
simulator.installApplet(cashAID, CashApplet.class);
|
||||
|
||||
cardTerminal = CardTerminalSimulator.terminal(simulator);
|
||||
|
||||
openPCSCChannel();
|
||||
@ -1432,6 +1438,24 @@ public class KeycardTest {
|
||||
assertArrayEquals(keyUID, response.getData());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Test the Cash applet")
|
||||
@Tag("manual")
|
||||
void cashTest() throws Exception {
|
||||
CashCommandSet cashCmdSet = new CashCommandSet(sdkChannel);
|
||||
APDUResponse response = cashCmdSet.select();
|
||||
assertEquals(0x9000, response.getSw());
|
||||
|
||||
ApplicationInfo info = new ApplicationInfo(response.getData());
|
||||
assertFalse(info.isInitializedCard());
|
||||
|
||||
byte[] data = "some data to be hashed".getBytes();
|
||||
byte[] hash = sha256(data);
|
||||
|
||||
response = cashCmdSet.sign(hash);
|
||||
verifySignResp(data, response);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Sign actual Ethereum transaction")
|
||||
@Tag("manual")
|
||||
|
Loading…
x
Reference in New Issue
Block a user