### Question:
GPKey { public byte[] getCheckValue(GPKeyCipher cipher) { if(!isCompatible(cipher)) { throw new UnsupportedOperationException("Cannot use " + mCipher + " key with cipher " + cipher); } switch(cipher) { case DES3: return GPCrypto.kcv_3des(this); case AES: return GPCrypto.kcv_aes(this); default: throw new UnsupportedOperationException("Cannot generate KCV for cipher " + cipher); } } GPKey(int keyId, GPKeyUsage usage, GPKeyCipher cipher, byte[] secret); int getId(); GPKeyUsage getUsage(); GPKeyCipher getCipher(); byte[] getSecret(); int getLength(); byte[] getCheckValue(GPKeyCipher cipher); SecretKey getSecretKey(GPKeyCipher cipher); String toString(); static final byte[] GLOBALPLATFORM_MASTER_SECRET; static final GPKey GLOBALPLATFORM_MASTER; }### Answer:
@Test public void testKeyCheckValueDES3() { byte[] kcv = GPKey.GLOBALPLATFORM_MASTER.getCheckValue(GPKeyCipher.DES3); Assert.assertArrayEquals(HexUtil.hexToBytes("8baf47"), kcv); }
@Test public void testKeyCheckValueAES() { byte[] kcv = GPKey.GLOBALPLATFORM_MASTER.getCheckValue(GPKeyCipher.AES); Assert.assertArrayEquals(HexUtil.hexToBytes("504A77"), kcv); }