29 lines
1.1 KiB
Java
29 lines
1.1 KiB
Java
package sega.a7;
|
|
|
|
import javacard.security.MessageDigest;
|
|
|
|
public class KeyChange extends AuthCommand {
|
|
private static final short RECV_PACKET_SIZE = 78;
|
|
private static final byte AUTH_LEVEL = 2;
|
|
private static final short PARAM_SIZE = 46;
|
|
|
|
public KeyChange(short cmd, AppData data, MakePacket packet, MessageDigest sha1,
|
|
HmacSha1 hmacSha1, Crypt crypt) {
|
|
super(cmd, RECV_PACKET_SIZE, PARAM_SIZE, AUTH_LEVEL, data, packet, sha1, hmacSha1, crypt);
|
|
}
|
|
|
|
public short core(byte[] data, short dataOffset, short dataLength) {
|
|
short ramD_dataSize = (short) 32;
|
|
byte[] ramD_newKey = this.m_ee_data.getGeneralBuffer_ramD();
|
|
if (ramD_newKey.length < ramD_dataSize)
|
|
return AppConfig.A7_FAIL;
|
|
|
|
short ramD_decSize = decData(data, (short) (dataOffset + 6), ramD_dataSize, ramD_newKey, (short) 0);
|
|
if (32 > (short) ramD_decSize)
|
|
return AppConfig.A7_FAIL;
|
|
|
|
boolean bRet = changeConnectionKey_ee(ramD_newKey, (short) 0, (short) 16, ramD_newKey, (short) 16, (short) 16);
|
|
return (short) (bRet ? 0 : 11);
|
|
}
|
|
}
|