I am trying to send data files from JC 2.2.2 card to a host app. All the files are less than 256 bytes. But the data needs to be encrypted and signed (for secure messaging) as shown below. After adding the MAC to the encrypted data the length of some of the files gets greater than 256 bytes. But I am using Extended Length so I thought there would be no problem with sending more than 256 bytes at once. The program works fine if the resulted cryptogram plus MAC is less than 256 bytes. Below is a piece of code that sends response apdu to the host.
Util.arrayCopyNonAtomic(file, offset, buffer, (short)0, file.length);
respLength = secureCrypto.wrapResponseAPDU(ssc, apdu, buffOfset, file.length);
apdu.setOutgoing();
apdu.setOutgoingLength(respLength); // 0x6F00 error occurs during the execution of this line
apdu.sendBytesLong(buffer, (short)0, respLength);
Card Details:
Terminal found : 2
PC/SC terminal OMNIKEY CardMan 5x21 0
PC/SC terminal OMNIKEY CardMan 5x21-CL 0
ATR: 13 bytes
Card Info : PC/SC card in OMNIKEY CardMan 5x21-CL 0, protocol T=1, state OK
At the host side I get 0x6F00 error code. And I have traced the program and found that the error occurs during the execution of apdu.setOutgoingLenght(respLength). In addition my applet class implements ExtendedLength interfcace. Any helpful information please