From 8799ed6dc7d9bd39817dc233c08eea7cfa6c99e2 Mon Sep 17 00:00:00 2001 From: Michele Balistreri Date: Sat, 29 Dec 2018 11:55:21 +0300 Subject: [PATCH] call genKeyPair as soon as possible to avoid timeouts on first installation ever on JCOP3 cards. Apparently no "wait" TPDUs are sent when the card does its very first ECC key generation --- src/main/java/im/status/keycard/KeycardApplet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/im/status/keycard/KeycardApplet.java b/src/main/java/im/status/keycard/KeycardApplet.java index 1d7151e..c00e0fc 100644 --- a/src/main/java/im/status/keycard/KeycardApplet.java +++ b/src/main/java/im/status/keycard/KeycardApplet.java @@ -149,6 +149,7 @@ public class KeycardApplet extends Applet { public KeycardApplet(byte[] bArray, short bOffset, byte bLength) { crypto = new Crypto(); secp256k1 = new SECP256k1(crypto); + secureChannel = new SecureChannel(PAIRING_MAX_CLIENT_COUNT, crypto, secp256k1); uid = new byte[UID_LENGTH]; crypto.random.generateData(uid, (short) 0, UID_LENGTH); @@ -173,7 +174,6 @@ public class KeycardApplet extends Applet { resetCurveParameters(); signature = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, false); - secureChannel = new SecureChannel(PAIRING_MAX_CLIENT_COUNT, crypto, secp256k1); duplicationEncKey = new byte[(short)(KeyBuilder.LENGTH_AES_256/8)]; expectedEntropy = -1;