7 Replies Latest reply: Jul 30, 2014 4:21 AM by Sebastien_Lorquet RSS

    Error: 6881: Function not supported - Logical channel not supported/open

    Diogo Souza

      Hi everyone.

       

      I'm trying to test an upload I've done to a java card with the following specs:

      • Java Card 2.2.2
      • GlobalPlatform 2.1.1
      • 3DES Visa Platform

       

      I can do all the upload process to the card correctly, but when I try to send an APDU command to it, I handle the following error:

      "6881: Function not supported - Logical channel not supported/open"

       

      Also, I couldn't find any information about this error at JavaCard's websites and forums.

       

      I've heard also that this is related to some information I have to pass through the CLA byte when sending the APDU command, that I'm sendind as 00 right now.

       

      Does anyone know what it could be?

        • 1. Re: Error: 6881: Function not supported - Logical channel not supported/open
          owlstead

          Did you SELECT the Applet after upload / installation? If you haven't, then you are likely still within Global Platform secure messaging.

          • 2. Re: Error: 6881: Function not supported - Logical channel not supported/open
            Diogo Souza

            Hi owlstead, thanks for replying.

             

            Yes, I did select the applet. And I have a successful message after this. The problem happens just when I try to send the first APDU...    

            • 3. Re: Error: 6881: Function not supported - Logical channel not supported/open
              Sebastien_Lorquet

              you did not tell something: what is the INS of the command you're trying to send? the INS for MANAGE CHANNEL (70h IIRC) is caught by the platform before your applet has a chance to see it.

              • 4. Re: Error: 6881: Function not supported - Logical channel not supported/open
                Diogo Souza

                Hi Sebastien,

                 

                The APDU command format is simple:

                 

                send_apdu -sc 0 -APDU 00250000060A0B0C0D0E0F7F

                 

                The INS byte is composed by an instruction to my applet (25 is an internal command). As I said, I think that the problem has some relation to the CLA byte, but if I put any other information on it instead of 00, the card reader locks itself, and I have to reinitialize everything...

                • 5. Re: Error: 6881: Function not supported - Logical channel not supported/open
                  owlstead

                  I guess we're a bit starved of information. Can you show us:

                  1. the set of installed load files and instance AID's from the card manager
                  2. the exact APDU trace log and
                  3. the applet code with regards to the handling of this APDU?

                   

                  Note that if the CM is not responsible, then it is likely the applet that returns this status word.

                   

                  If that is unlikely, the card reader becomes suspect. Be warned against buggy readers and check if you are actually talking to the right reader in the first place.

                   

                  Make sure that there weren't any errors uploading/installing the applet too, otherwise you may be talking to the wrong applet.

                  • 6. Re: Error: 6881: Function not supported - Logical channel not supported/open
                    Diogo Souza

                    Ok, let's go.

                     

                    1. When I acces the CM, running a get_status -element 20 command, we have this:

                    List of elements (AID state privileges)

                    // ... pre-installed applets

                    01020304050607080900    1       0

                    a00000006203010c01       1       0

                     

                    Additionally, if we run a get_status -element 40, we have:

                    List of elements (AID state privileges)

                    0102030405060708090000  7       2

                    a00000006203010c0101     7       2

                     

                    Where the first applet is simple HelloWorld (that is working), and the second one is the applet I'm working on.

                     

                    2. To turn it easier, I'm gonna send the image of the trace:

                    http://i1287.photobucket.com/albums/a623/diogosouzac/trace_apdu_zpscf5bc015.png

                    What I analyse, also, that seems strange is the response from the SELECT APDU: 00A404009000. The other applets just respond with 9000 code.

                     

                    3. The applet code is simple, no much code. This is the process method:

                     

                    byte buffer[] = apdu.getBuffer();
                    byte ins = buffer[ISO7816.OFFSET_INS];
                    
                    
                    // To protect against signing of arbitrary buffer contents
                    if (ins != Instructions.GetServerToken && init.getServerTokenLength() > 0)
                      init.setServerTokenLength((short) 0);
                    
                    
                    switch (ins) {
                    case ISO7816.INS_SELECT:
                      apdu.setOutgoing();
                      apdu.setOutgoingLength((short)4);
                      apdu.sendBytes(ISO7816.OFFSET_CLA, (short)4);
                      break;
                    case Instructions.GetReturnData:
                      if (init.getReturnBufferLength() > 0) {
                      apdu.setOutgoing();
                      apdu.setOutgoingLength(init.getReturnBufferLength());
                      Util.arrayCopy(init.getReturnBuffer_t(), (short)0, buffer, (short)0, init.getReturnBufferLength());
                      apdu.sendBytes((short)0, init.getReturnBufferLength());
                      Util.arrayFillNonAtomic(buffer, (short)0, init.getReturnBufferLength(), (byte)0);
                      Util.arrayFillNonAtomic(init.getReturnBuffer_t(), (short)0, init.getReturnBufferLength(), (byte)0);
                      init.setReturnBufferLength((short)0);
                      }
                      break;
                    }
                    

                     

                    I have just one reader. I'm connection to the right one, because I've already connected successfully with other applets.

                     

                    Also, the upload works fine. Any error at this time.

                    • 7. Re: Error: 6881: Function not supported - Logical channel not supported/open
                      Sebastien_Lorquet

                      select replies with 4 bytes because that's what you're asking here:

                       

                      1. apdu.setOutgoing();
                      2.   apdu.setOutgoingLength((short)4); 
                      3.   apdu.sendBytes(ISO7816.OFFSET_CLA, (short)4); 


                      at this moment you did not write anything in the apdu buffer, so the reply contains whatever the buffer contained before, eg the command.


                      the function 0x25 you're writing is also just wrong, you send data to your card, but don't read it. The card cannot handle this.


                      please take more time understanding what you're trying to do. there are tons of sample codes.


                      BR