The method
short javacard.framework.APDU.setIncomingAndReceive()
returns negative values if more than 128 Bytes are received.
Seems like a problem with casting a byte to a short variable.
As a workaround I use a method like this:
private short apduSetIncomingAndReceive(APDU apdu){
short len = apdu.setIncomingAndReceive();
if (len < 0){
len = (short) (len & 0xff);
}
return len;
}
From petermah...@gmail.com on October 02, 2013 21:30:03
The method short javacard.framework.APDU.setIncomingAndReceive() returns negative values if more than 128 Bytes are received. Seems like a problem with casting a byte to a short variable.
As a workaround I use a method like this: private short apduSetIncomingAndReceive(APDU apdu){ short len = apdu.setIncomingAndReceive(); if (len < 0){ len = (short) (len & 0xff); } return len; }
Original issue: http://code.google.com/p/jcardsim/issues/detail?id=24