-1

While sending data from javacard in the form APDU commands using the apdu.sendBytesLong() Function, I am able to send 127 bytes data as response but 128 bytes data give error code 6f00(SW_UNKNOWN). Why is this happening and can anybody suggest the way around without splitting the data into two apdu commands.

le = apdu.setOutgoing();
            if(le != 128)
                ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
apdu.setOutgoingLength((byte)le);
apdu.sendBytesLong(mod_PkAIKR,(short)0, le);

where mod_PkAIKR is an byte array of 128 bytes.

Thank you

  • How do you expect us to find out without revealing the relevant parts of your code? And by relevant I mean the part of the Java Card code where you process the APDU and the APDU trace of your communication with the card. – Michael Roland Apr 06 '17 at 10:17
  • @MichaelRoland There is no need of code but still I have added. – Sarang S. Chaturvedi Apr 06 '17 at 10:24
  • Sure you need to post code (see http://stackoverflow.com/help/mcve) if you expect us to find out why your *code* does not work. – Michael Roland Apr 06 '17 at 13:18

1 Answers1

0

Change apdu.setOutgoingLength((byte)le); to apdu.setOutgoingLength(le);

  1. The parameter type of api apdu.setOutgoing() is short, it didn't needs type convert.
  2. If you convert le to type byte, the parameter value will be a nagative. the value of (byte) 128 is -128.
JavaCardOS
  • 491
  • 2
  • 7