1 2 Previous Next 25 Replies Latest reply: Mar 9, 2012 11:47 PM by 921673 Go to original post RSS
      • 15. Re: Extended APDU through T0
        Umer
        Mehdi wrote:
        OK. Data that I tried to send in this case is 784 bytes in length so it should be split into 4 APDU commands. Should I handle everything by myself? Should the applet be aware of this and handle T0 and T1 in different way?
        Now you got the point. Yes your applet should be aware of it. And there are many threads on command chaining previously discussed and even code is also available in the form of examples.
        • 16. Re: Extended APDU through T0
          safarmer
          Hi,

          Can you confirm that your card supports extended length APDU's? Even in a JC2.2.2 card support for extended apdu's is optional.

          If you can confirm it does support them, we can look further at your code.

          Cheers,
          Shane
          • 17. Re: Extended APDU through T0
            921673
            Hi Shane,

            According to the product manual:
            This product supports extended APDUs under both T=0 and T=1 protocols.
            Which puts doubt on Umer's point.

            Regards
            Mehdi
            • 18. Re: Extended APDU
              922034
              HI,
              I am using extended length APDU. I get proper response until i use 1F00 bytes. When i send more bytes than this, i get an exception( sun.security.smartcardio.PCSCException: Unknown error 0x1f ). Am using smartcardio implementation in java to communicate with a PCSC device.Any idea how to solve this exception and get a response for an APDU with payload more than 1F00 bytes?
              • 19. Re: Extended APDU
                Umer
                Please create your own thread.
                • 20. Re: Extended APDU through T0
                  safarmer
                  Hi,

                  6D00 is INS not supported so that tool may not be selecting your applet.

                  I tried your code and the following worked for me (some modifications) on a T=1 card. I do not have T=0:
                    private void processInitialize(APDU apdu) {
                      if (cardStatus == ST_INITIALIZED) ISOException.throwIt(SW_CARD_ALREADY_INITIALIZED);
                      byte[] buffer = apdu.getBuffer();
                      short rcvLen = apdu.setIncomingAndReceive();
                      short lc = apdu.getIncomingLength(); // moved to after the call to setIncomingAndRecieve as this throws an error
                      short offCdata = apdu.getOffsetCdata();
                  
                      // Change how you handle partial input
                      while(rcvLen < lc) {
                        rcvLen += apdu.receiveBytes(rcvLen);
                      }
                  
                      byte[] data = new byte[rcvLen];
                      Util.arrayCopyNonAtomic(buffer, offCdata, data, (short) 0, rcvLen); // Non Atomic as it exceeded my transaction buffer size
                      content.setData(data);
                      cardStatus = ST_INITIALIZED;
                    }
                  Cheers,
                  Shane
                  • 21. Re: Extended APDU through T0
                    921673
                    Hi Shane,

                    Thanks. Swapping setIncomingAndReceive and getIncomingLength did resolved another problem of mine. It appeared on a product but not on others. Seeing 6D00 first time I thought the applet is not selected but it was not the case because the tool works as expected when data length is less than 256 bytes. I am really confused.

                    Regards
                    Mehdi
                    • 22. Re: Extended APDU through T0
                      922034
                      I agree that T=1 supports more than 256 bytes. Because i am able to get a response when i send 1F00 bytes. But if i send more than this, i get an exception. Please find the APDU that i send below

                      Extended length APDU

                      00010000007ff81111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.............................................7ff8

                      Response
                      javax.smartcardio.CardException: sun.security.smartcardio.PCSCException: Unknown error 0x1f
                      • 23. Re: Extended APDU through T0
                        921673
                        Hi,
                        I agree that T=1 supports more than 256 bytes. Because i am able to get a response when i send 1F00 bytes. But if i send more than this, i get an exception. Please find the APDU that i send below *...*
                        Please open another thread. Discussion here goes on Extended APDU through T0.

                        Regards
                        Mehdi
                        • 24. Re: Extended APDU through T0
                          801926
                          If you're using by chance JCOP, extended length is supported only for T=1 and T=CL.
                          • 25. Re: Extended APDU through T0
                            921673
                            Hi,

                            My card is not JCOP and its manual says that extended APDU is supported over both T0 and T1. I am still investigating. If I can not find the reason in time I have to use chaining because there is a deadline.

                            Regards
                            Mehdi
                            1 2 Previous Next