### Question:
SCP03Derivation { public static GPKeySet deriveSessionKeys(GPKeySet staticKeys, byte[] sequence, byte[] hostChallenge, byte[] cardChallenge) { String name = staticKeys.getName() + "-SCP03:" + HexUtil.bytesToHex(sequence); byte[] context = ArrayUtil.concatenate(hostChallenge, cardChallenge); GPKeySet derivedSet = new GPKeySet(name, staticKeys.getKeyVersion(), staticKeys.getDiversification()); for (GPKeyUsage usage : KEYS) { GPKey staticKey = staticKeys.getKeyByUsage(usage); if(staticKey != null) { GPKey sessionKey; if(CONSTANTS.containsKey(usage)) { byte constant = CONSTANTS.get(usage); byte[] sessionSecret = GPBouncy.scp03_kdf(staticKey, constant, context, staticKey.getLength() * 8); sessionKey = new GPKey(staticKey.getId(), usage, GPKeyCipher.AES, sessionSecret); } else { sessionKey = new GPKey(staticKey.getId(), usage, GPKeyCipher.AES, staticKey.getSecret()); } derivedSet.putKey(sessionKey); } } return derivedSet; }  static GPKeySet deriveSessionKeys(GPKeySet staticKeys, byte[] sequence, byte[] hostChallenge, byte[] cardChallenge);  }### Answer:
@Test public void testDeriveSCP03_000010() { byte[] cardSequence = HexUtil.hexToBytes("000010"); byte[] hostChallenge = HexUtil.hexToBytes("A7F76C713F0A713D"); byte[] cardChallenge = HexUtil.hexToBytes("31900058C1C451A2"); GPKeySet derived = SCP03Derivation.deriveSessionKeys(GPKeySet.GLOBALPLATFORM, cardSequence, hostChallenge, cardChallenge); Assert.assertEquals(0, derived.getKeyVersion()); GPKey encKey = derived.getKeyByUsage(GPKeyUsage.ENC); Assert.assertEquals(GPKeyUsage.ENC, encKey.getUsage()); Assert.assertEquals(GPKeyCipher.AES, encKey.getCipher()); Assert.assertArrayEquals(HexUtil.hexToBytes("258a78866f41482bef482dc8ca976ccd"), encKey.getSecret()); GPKey macKey = derived.getKeyByUsage(GPKeyUsage.MAC); Assert.assertEquals(GPKeyUsage.MAC, macKey.getUsage()); Assert.assertEquals(GPKeyCipher.AES, macKey.getCipher()); Assert.assertArrayEquals(HexUtil.hexToBytes("053db6abc7fdf3b63a0d965ee16b0255"), macKey.getSecret()); GPKey rmacKey = derived.getKeyByUsage(GPKeyUsage.RMAC); Assert.assertEquals(GPKeyUsage.RMAC, rmacKey.getUsage()); Assert.assertEquals(GPKeyCipher.AES, rmacKey.getCipher()); Assert.assertArrayEquals(HexUtil.hexToBytes("eda0b4f2ec0345bfc50f3bc59cfef936"), rmacKey.getSecret()); GPKey kekKey = derived.getKeyByUsage(GPKeyUsage.KEK); Assert.assertEquals(GPKeyUsage.KEK, kekKey.getUsage()); Assert.assertEquals(GPKeyCipher.AES, kekKey.getCipher()); Assert.assertArrayEquals(HexUtil.hexToBytes("404142434445464748494A4B4C4D4E4F"), kekKey.getSecret()); }