How handle short "apdu" command ?

Hi,
I'm currently working on a project where I have to develop an applet to anwser to some specific commands.
But some of these commands are only 2 byte length and consequently, don't match with APDU ISO schema (4 byte mandatory).
So the answer I obtain from the applet is only an error (6881) and I'm wondering if there is a way to do handle short commands.
Nico

To describe a little more my problem :
cm>  /send 00
=> 00                                                 .
(680533 nsec)
<= 00 00 00 00 00 90 00                               .......
Status: No Error
cm>  /send 01
=> 01                                                 .
(419327 nsec)
<= 68 81                                              h.
Status: 0x6881
cm>  /send A0
=> A0                                                 .
(554260 nsec)
<= 6D 00                                              m.
Status: INS value not supportedIndeed, I don't understand why, with some byte, it works such as 0x00 or 0xA0 and with other it doesn't (0x01).
Have you any idea how make it work ?

Similar Messages

  • APDU Commands - How they work ?

    Hi,
    Iam all new to the JavaCard programming and wanted to understand some basics. The APDU Commands (CLA, INS, P1, P2, ...) are they reserved commands (as in reserved words). If so, how do I get a listing of the same.
    Eg. I am looking into one of the programs which have the following few lines,
    SetLength(DataToSend, 13);
    DataToSend[0] := $88;
    DataToSend[1] := $10;
    DataToSend[2] := $11;
    DataToSend[3] := $00;
    DataToSend[4] := $08;
    DataToSend[5] := $F9;
    DataToSend[6] := $FD;
    DataToSend[7] := $CE;
    DataToSend[8] := $8B;
    DataToSend[9] := $F6;
    DataToSend[10] := $F4;
    DataToSend[11] := $14;
    DataToSend[12] := $E0;
    FSCard.SendCustomAPDU(DataToSend, ReceiveBuffer);
    I believe the above writes info. to the card.
    If Yes, how do I retrive the same from Card?
    If No, then what does the instruction stand for?
    Appreciate your help ....

    hI,
    Iam trying to write a sample code by trying to write data to card using XOR, converting the same back in the applet to the original string and retriving the same. The return value is still in XOR value and not the original i sent. Please let me know what iam doing wrong here?
    WRITING DATA:
    CLIENT PROGRAM:
    SetLength(DataToSend, 9);
    DataToSend[0] := $88;
    DataToSend[1] := $10;
    DataToSend[2] := $9A;
    DataToSend[3] := $00;
    DataToSend[4] := $4;
    DataToSend[5] := $A;
    DataToSend[6] := $B;
    DataToSend[7] := $C;
    DataToSend[8] := $D;
    DataToSend[5] := DataToSend[5] XOR DataToSend[6];
    DataToSend[6] := DataToSend[6] XOR DataToSend[7];
    DataToSend[7] := DataToSend[7] XOR DataToSend[8];
    DataToSend[8] := DataToSend[8] XOR DataToSend[5];
    FSCard.SendCustomAPDU(DataToSend, ReceiveBuffer);
    APPLET CALLS THIS PROCEDURE :
    private void SetStringSec5(APDU apdu) {
              byte buffer[] = apdu.getBuffer();
              byte size = (byte)(apdu.setIncomingAndReceive());
              byte index;
    byte indexsn;
    indexsn=0;
              // Store the length of the string and the string itself
              TheBuffer[80] = size;
              for (index = 80; index < (byte)(81+(int)(size)); index++){
                   TheBuffer[(byte)(index + 1)] = buffer[(byte)(ISO7816.OFFSET_CDATA + indexsn)];
    indexsn++;
              CalcSri();
    apdu.setOutgoing();
              apdu.setOutgoingLength((short)size);
    apdu.sendBytesLong(TheBuffer,(short)0,(short)size);
              return;
    private void CalcSri() {
              TheBuffer[(byte)(8)]=(byte)(((int)(TheBuffer[(byte)(5)])) ^ ((int)(TheBuffer[(byte)(8)])));
    TheBuffer[(byte)(7)]=(byte)(((int)(TheBuffer[(byte)(8)])) ^ ((int)(TheBuffer[(byte)(7)])));
              TheBuffer[(byte)(6)]=(byte)(((int)(TheBuffer[(byte)(7)])) ^ ((int)(TheBuffer[(byte)(6)])));
              TheBuffer[(byte)(5)]=(byte)(((int)(TheBuffer[(byte)(6)])) ^ ((int)(TheBuffer[(byte)(5)])));
              return;
    READING DATA:
    CLIENT PROGRAM :
    //Get string from the card
    SetLength(DataToSend, 5);
    DataToSend[0] := $88;
    DataToSend[1] := $10;
    DataToSend[2] := $BE;
    DataToSend[3] := $00;
    DataToSend[4] := $4;
    FSCard.SendCustomAPDU(DataToSend, ReceiveBuffer);
    APPLET CODE CALLING THE PROCEDURE:
    private void GetStr(APDU apdu) {
              byte buffer[] = apdu.getBuffer();
              byte numBytes = buffer[ISO7816.OFFSET_LC];
              apdu.setOutgoing();
              apdu.setOutgoingLength(numBytes);
              byte index;
    byte indexsn;
    indexsn=0;
              for (index = 80; index <= (byte)(80+(int)(numBytes)); index++){
                   buffer[(byte)(indexsn)] = TheBuffer[(byte)(index + 1)];
    indexsn++;
    apdu.sendBytesLong(buffer,(short)0,(short)numBytes);
              return;
    }

  • APDU commands for Globalplatform card

    Hi,
    I'm trying to develop embedded software that talks to a Oberthur Cosmo 64 card via low level APDU commands. I've looked at the Globalplatform 2.1.1 specs as well as the cosmo 64 technical brief, but it seems that there are only a few APDU commands. I've only worked with native cards before this, and native cards seem to have a lot more commands. For example, I can't even find a "Get Challenge" command nor any kind of authentication/key generation/pin verification commands.
    Would like to know how I can get started just sending simple APDU commands for key generation, challenge-response, authentication, etc?

    galapogos wrote:
    Well I only see 10 commands under Part IV(APDU Command Reference) of the GPP 2.1.1 specs.
    However when I see Appendix D I realize there's actually an initialize update and external authenticate APDU command, neither of which are found in Part IV.Yes, the commands for secure channel protocol are located in the Appendices. One can argue if this commands should be listed in APDU Command Reference, but GP Committee wanted to make is as flexible as possible in case another SCP is added, with different commands.
    From what I've read so far in Appendices D/E, it seems that the difference is that
    1) SCP01 supports mutual auth while for SCP02, only the card auths the host, with an option for the reverse.
    2) For SCP01, card ensures host is genuine, but no mention of the reverse to be true. For SCP02, both host and card must be ensured to be genuine.
    3) For SCP01, data from host to card is not susceptible to sniffing(encryption?), but no mention of the reverse to be true. For SCP02, both directions are not susceptible to sniffing.You are referencing the R-MAC option. It is only present in SCP02. There is no encryption from the card side (smthg like R-ENCRYPTION), you would need to handle this in your Applet. Be aware that R-MAC is optional, depending on the security policy of the issuer. For example in JCOP, only C-MAC and C-DECRYPTION is supported. Another differences between SCP01 and SCP02:
    - The DEK in SCP02 is a session key, and in SCP01 it is static
    - The INITIALIZE UPDATE command is different regarding the P2 parameter and the structure of the response
    In the latest version of GP 2.2 SCP01 is deprecated.
    Seems like other than the initial authentication, SCP02 is always more secure than SCP01?I would only conclude this if R-MAC is supported in SCP02.
    Also, where can I find Java Card 2.2.1/2.2.2 specs? I'm not interested in using the API since I'm developing embedded firmware, so I need to talk to the card directly via APDU commands.http://java.sun.com/products/javacard/specs.html

  • What is the data associated with the APDU commands

    hi,
    Please guide me on what data should be associated with the command APDU.
    for eg. we send 00 a4 04 00 for the select command followed by the AID.
    Similarly what should be sent as a data (eg. AID in case of SELECT) with following APDU commands::::
    LOAD,, InItUPDATE,, External Authentication,, Install
    regards,,
    PhadkeA

    I have the book Javacard technology for smartcards by Zhiqun Chen so
    I" ll try to help you. About the install command it's syntax is:
    install(byte[] bArray,short bOffset,byte bLength)
    The bArray contains the installation parameters, but from what I read in
    the book they are optional. From the example of the book it seems
    that generally they are some initialization values for the variables of
    the applet.
    I didn't find any info about the other commands that you mention.Sorry!

  • Status 69c2 on Verify APDU command

    Hi,
    I have successfully complete the APDU command new CommandAPDU(0x00, 0x20, 0x00, 0x01, new byte[]{ 0x31, 0x32, 0x33, 0x34, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF } ) for verify with the correct pin code (1234). I get status 0x9000.
    But when i try with wrong pin code i get status response 0x69C2. Why I get this status instead of 0x63Cx, as ISO7816-4 states? If i get 0x63Cx i can use the last value to calculate how many tries remaining!
    Beside this, not so much information exist for status response 0x69C2. It means "swAccessDenied 69C2 -The required access conditions were not satisfied".
    What an i doing wrong? What to do to get status 0x63Cx if the pin is wrong?
    Thank you
    Edited by: Valentino on Aug 22, 2012 5:02 AM

    Hi,
    Valentino wrote:
    Is this behavior normal?The status word bytes SW1-SW2 are defined by specification for your card application. What application are you using?
    May be a developer of your card application mistook with the status word SW1 0x69 instead of 0x63 for VERIFY command as a status for wrong PIN-code? ;)
    The value x in the status word SW2 0xCx defines the amount of the attempts remained.
    So it would be normal for each next wrong PIN-code entered to get the status words: 69C2 -> 69C1 -> 69C0 -> 6983

  • Issuing apdu commands

    I am experiencing problems running the demos that come with the java card kit such as the wallet and javapurse. i am able to run the apdutool utility with the the specified script file as input without any problems. But does it just end there? I thought it was possible for me to key in specific commands for crediting or debiting electronic cash in the wallet applet, for example. My question is-once I generate the output file, how do i proceeed from there - so that finally i can be able to send specific apdu commands to the sample applets. I would appreciate help soon so that i can be able to apply in a project i am undertaking.

    I am experiencing problems running the demos that come with the java card kit such as the wallet and javapurse. i am able to run the apdutool utility with the the specified script file as input without any problems. But does it just end there? I thought it was possible for me to key in specific commands for crediting or debiting electronic cash in the wallet applet, for example. My question is-once I generate the output file, how do i proceeed from there - so that finally i can be able to send specific apdu commands to the sample applets. I would appreciate help soon so that i can be able to apply in a project i am undertaking.

  • How to use apdu to get the certificate in smartcard?

    hi,guys
    how could i use the apdu command to get the certificate in smart card.
    now i sent following commands in JCOP shell
    /send 00a404000cA000000063504B43532D3135
    /send 00a4000c023f00
    /send 00a4000c025031
    /send 00a40200024404
    /send 00b0000080
    /send 00b0008080
    what's the next step?

    i'm using the A.E.T's safesign card,i just only use the apdu to load from card.
    but it's seems like it's can't load whole certificate.

  • How to execute unix command in plsql block( urgent)

    Hi All,
    i want rename the unix folder to New name on update non_employee table . So, please give me idea how to use unix command here.... Please suggest me ASAP ... Its urgent
    CREATE or REPLACE TRIGGER NON_EMPLOYEE_AftUpd_trg
    AFTER UPDATE ON NON_EMPLOYEE
    FOR EACH ROW
    BEGIN
    IF :new.DIST_LIVELINK_PATH <> :old.DIST_LIVELINK_PATH THEN
    rename unixfolder1 to :new.dist_livelink_path.
    end IF;
    END;

    The solution will depend a lot on your Oracle version, which you forgot to mention ;)
    btw shouldn't that be (in pseudocode)
    rename :old.dist_livelink_path to :new.dist_livelink_pathotherwise it will always fail after the first time?
    In Unix that would require the mv command.

  • How to execute unix command line from cocoa?

    how to execute unix command line from cocoa?
    for example, if I want to call "ping" from cocoa, how should I do it? and how can I obtain the return value?
    thank you.
    Power G5 Quad Mac OS X (10.4.3)

    The following article may also help:
    http://cocoadevcentral.com/articles/000025.php
    Mihalis.
    Dual G5 @ 2GHz   Mac OS X (10.4.6)  

  • How to short close a Service PO

    Hi Gurus,
    How to short close a Service PO like we do for Stock PO by ticking Delivery Completed Indicator.
    Regards

    Hi,
    If u used the Frame work PO document type for the Service PO.
    Then change the validity of the PO to short close it.
    If u have used the standard  Po option then change the qty of the sevices to availed till date.
    regards,
    sujit

  • How can hide the command line of a t.code in the portal

    Dear Experts.
    I have the following doubt:
    How can hide the Command Line of a Report that is called with a T.Code in the portal?
    Attach Image:
    [Image T.Code|http://www.freeimagehosting.net/uploads/eab3b6a03c.jpg]
    When I created a service using the T.Code SICF for the T.Code , I can hide buttons and the filed command line  using
    ~webgui_simple_toolbar
    ~singletransaction
    ~NOHEADEROKCODE
    With notes 1010519, "SAP GUI for HTML: Simplified Title Area Without Menu and OK Code" and 959417.
    But the problem is that when I create the service in the T.Code SICF, I also have that create an Iview IAC in the portal.
    The Question is : How can hide this fields and buttons if I want Publish the T.code using an Iview Transaction in the portal?
    In this moment I have used the two options:
    1 option) I created a service using the t.Code SICF for my Transaction and I also created an Iview IAC in the portal for call the service.
    RESULT:
    SAP Web Application Server
             500 Connection timed out
            Error: -5
           Version: 7000
           Component: ICM
           Date/Time: Sat Jun 12 20:26:39 2010 
           Module: icxxthr_mt.c
           Line: 2698
           Server: xyxab...
    Error Tag: {-}
    Detail: Connection to partner timed out after 60s
    2)  created an Iview Transaction  in the portal and  call my transaction.
    RESULT.
    [Image T.Code|http://www.freeimagehosting.net/uploads/eab3b6a03c.jpg]
    But not can hide the field Command Line and other buttons.
    I think that the command :
    ~webgui_simple_toolbar
    ~singletransaction
    ~NOHEADEROKCODE
    Only can be used if I create a service using the T.Code SICF .
    Best Regards
    Carmen.

    Hi Carmen,
    The bottom line is that this cannot be done for transaction iviews without modifying the standard webgui service in SICF, which is probably not a good idea (since it affects everyone using SAP GUI for HTML). (You could hack the appintegrator to add the ~webgui_simple_toolbar parameter to the transaction URL template in the portal, but again its not a recommended thing to do ...). Better to create an IAC service in SICF with ~webgui=1 where you set the required appearance using an appropriate value for ~webgui_simple_toolbar, and then create an IAC iview to point at this service.
    You can even override the ~transaction value configured in the new service in individual IAC iviews by entering the appropriate value in the application parameter of the iview, for example:
    ~okcode=/nSU01
    And you can pass parameters in the same way:
    ~okcode=/nSU01 USR02-BNAME=xyz;USREFUS-USERALIAS=abc;
    By the way, it would not be recommended to create a URL iview to access an IAC, since you are likely to encounter session management issues in this scenario - better to use an IAC iview.
    Regards, Rory

  • How to break the command line in SAP scripts

    Hi,
      Can any one Please guide me how to continue the command line( /: ) of SAP SCPRIPT into multiple lines.
    Regards
    Kiran

    Hi Kiran,
    U can continue in the same line itself by pressing SHIFT+F8
    If u want it in the next line then u can give space in the tag column.
    Thanks,
    Vinod.

  • How to disable sudo command in Terminal

    How to disable sudo command in Terminal

    Bad idea.
    Only an Admin user can use sudo, so if you have users on your system that you do not want to use sudo, then do not give them an admin account, and do not give them the password for an admin account.

  • How to install TOP command

    Can anyone guide me how to install TOP command in solaris 10, 64bit OS?
    thanks

    top is not a native Solaris command but the Solaris 10 3.5.1 top package is available for SPARC & X86 on:
    http://sunfreeware.com/
    It may also be on one of your numerous Solaris 10 CD's. Which one? I haven't a clue.

  • JDev TP4 DVT:Map Component: How to send a command to Mapviewer Server?

    How to send a command to Mapviewer Server programmatically using a DVT:Map component? ( for example : To capture a Theme info when i clicking in the a map theme position?
    Juan C LLanes

    Hi Juan,
    Are you trying to click on a point in the map and update another control on the page?
    This is available today, if you create a master-detail binding and bind the master to your map theme, and detail to another view e.g. a table, and check the checkbox "Enable row selection" when you create the map theme binding, then you will get this behavior automatically.
    If this is not what you are looking for, please clarify.
    Thanks
    Katia

Maybe you are looking for

  • Follow up to IPod touch question about kicking back to menu

    What it's doing is while at a site such as Facebook or while reading something on MSN or ESPN, the screen goes black and kicks back to the  icon menu- very annoying- what can I do?

  • Calendar Problem- Help needed

    Hi: I have a google calendar but I did not use a Gmail account to set up the calendar. Instead, I used a pop account from my isp service provider- who is cogeco.ca I am trying to sync my google calndar to my Blackberry built in calendar. I can't seet

  • NULLIF Function converts to illegal DECODE Statement

    I am converting a SQLServer 2000 application to Oracle 8i (release 3) using release 9.2.0.1.7 of the Migration Workbench. I have 39 SQLServer stored procedures which utilize the NULLIF function. The Migration Workbench is converting the NULLIF into a

  • Coustomer statement of accounts

    Hi all, i wanted to take the SOA . We want to include 31st March 09 and Prior Open Items separately in SOA. Basically break the opening balance into 2 parts:1)Opening Balance for Period 31st March 2009 and Prior2)Opening Balance for Period 01St April

  • Can I shorten or rename the dedicated link to a web form?

    Can I shorten or rename the dedicated link to a web form?