From 245e26730dd8e3232f53b8ecf41b03deb477884a Mon Sep 17 00:00:00 2001 From: Michele Balistreri Date: Tue, 11 Dec 2018 11:42:17 +0300 Subject: [PATCH] use unified SDK --- build.gradle | 3 ++- src/test/java/im/status/keycard/KeycardTest.java | 12 +++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 7492f2b..329893d 100644 --- a/build.gradle +++ b/build.gradle @@ -41,7 +41,8 @@ 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-android:desktop:07b900577d') + testCompile('com.github.status-im.status-keycard-android:desktop:969ae6b2b5') + 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") } diff --git a/src/test/java/im/status/keycard/KeycardTest.java b/src/test/java/im/status/keycard/KeycardTest.java index 876cbfe..5b0b1b0 100644 --- a/src/test/java/im/status/keycard/KeycardTest.java +++ b/src/test/java/im/status/keycard/KeycardTest.java @@ -27,7 +27,6 @@ import org.web3j.utils.Convert; import org.web3j.utils.Numeric; import javax.smartcardio.*; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -39,7 +38,7 @@ import java.nio.ByteOrder; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.Signature; -import java.security.interfaces.ECPublicKey; +import org.bouncycastle.jce.interfaces.ECPublicKey; import java.util.Arrays; import java.util.Random; @@ -1430,13 +1429,8 @@ public class KeycardTest { return new Sign.SignatureData(v, rB, sB); } - private void verifyKeyUID(byte[] keyUID, ECPublicKey pubKey) throws Exception { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - bos.write(0x04); - bos.write(pubKey.getW().getAffineX().toByteArray()); - bos.write(pubKey.getW().getAffineY().toByteArray()); - - verifyKeyUID(keyUID, bos.toByteArray()); + private void verifyKeyUID(byte[] keyUID, ECPublicKey pubKey) { + verifyKeyUID(keyUID, pubKey.getQ().getEncoded(false)); } private void verifyKeyUID(byte[] keyUID, byte[] pubKey) {