From 9620381ddf245433ee3452de1bb6b397502d07c1 Mon Sep 17 00:00:00 2001 From: Gabe Wachob Date: Sun, 23 Jan 2022 15:06:39 -0800 Subject: [PATCH] Fixe https://github.com/martinpaljak/GlobalPlatformPro/issues/281 --- library/src/main/java/pro/javacard/gp/GPSession.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/pro/javacard/gp/GPSession.java b/library/src/main/java/pro/javacard/gp/GPSession.java index 56b9661b..3f9185f8 100644 --- a/library/src/main/java/pro/javacard/gp/GPSession.java +++ b/library/src/main/java/pro/javacard/gp/GPSession.java @@ -378,7 +378,7 @@ public void openSecureChannel(GPCardKeys keys, GPSecureChannelVersion scp, byte[ // P1 key version (all) // P2 either key ID (SCP01) or 0 (SCP02) - CommandAPDU initUpdate = new CommandAPDU(CLA_GP, INS_INITIALIZE_UPDATE, keys.getKeyInfo().getVersion(), scp.scp == GPSecureChannelVersion.SCP.SCP01 ? keys.getKeyInfo().getID() : 0, host_challenge, 256); + CommandAPDU initUpdate = new CommandAPDU(CLA_GP, INS_INITIALIZE_UPDATE, keys.getKeyInfo().getVersion(), (scp != null && scp.scp == GPSecureChannelVersion.SCP.SCP01) ? keys.getKeyInfo().getID() : 0, host_challenge, 256); ResponseAPDU response = channel.transmit(initUpdate); int sw = response.getSW();