29 lines
1.0 KiB
Java
29 lines
1.0 KiB
Java
package sega.a7;
|
|
|
|
import javacard.security.MessageDigest;
|
|
|
|
public class HmacChange 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 HmacChange(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_newHmac = this.m_ee_data.getGeneralBuffer_ramD();
|
|
if (ramD_newHmac.length < ramD_dataSize)
|
|
return AppConfig.A7_FAIL;
|
|
|
|
short ramD_decSize = decData(data, (short) (dataOffset + 6), ramD_dataSize, ramD_newHmac, (short) 0);
|
|
if (20 > ramD_decSize)
|
|
return AppConfig.A7_FAIL;
|
|
|
|
this.m_ee_data.setKh_ramD(ramD_newHmac, (short) 0, (short) 20);
|
|
return AppConfig.A7_SUCCESS;
|
|
}
|
|
}
|