vJCRE icon indicating copy to clipboard operation
vJCRE copied to clipboard

sendBytesLong doesn't throw an exception if setOutgoingLength not called

Open vletoux opened this issue 8 years ago • 1 comments

According to http://www.win.tue.nl/pinpasjc/docs/apis/jc222/javacard/framework/APDU.html#sendBytesLong%28byte[],%20short,%20short%29

"throws:(...) APDUException.ILLEGAL_USE if setOutgoingLength() not called or setOutgoingAndSend() previously invoked or response byte count exceeded or if APDUException.NO_T0_GETRESPONSE or APDUException.NO_T0_REISSUE or APDUException.NO_T0_REISSUE previously thrown. "

Indeed no check is done on sendBytesLong for that https://github.com/martinpaljak/vJCRE/blob/85c7828089fcde0fa8cde89a622b5ec582804947/src/pro/javacard/vre/vAPDU.java#L92

Took me a while to find the problem in my card when testing on the card while it was fine on the emulator ;-)

vletoux avatar Nov 08 '15 17:11 vletoux