This discussion is archived
13 Replies Latest reply: Oct 16, 2012 11:23 PM by Valentino RSS

Read Object Label

Valentino Newbie
Currently Being Moderated
Hi, I read object from my Java Card successfully. But how can I get the label / it's name/ of that object? When I select EF DODF I can read the number of data objects from FCI /FIle Control Information/, Tag 82 for LINEAR-TLV.

The FCI from selecting the object is - 6f 13 80 02 02 24 82 01 01 83 02 57 01 86 06 01 01 01 ff ff 01.
Tag 80 - file size 80 02 *02 24*
Tag 83 - FID 83 02 *57 01*

But how can I get the name /Label/ of the object?

Thank you

Edited by: Valentino on Sep 14, 2012 1:05 AM
  • 1. Re: Read Object Label
    Valentino Newbie
    Currently Being Moderated
    The created objects also have "application" name. So how can I read it? If this is specified somewhere in ISO 7816-4 please let me know, so far i did not find it there!
    Thank you
  • 2. Re: Read Object Label
    Valentino Newbie
    Currently Being Moderated
    no answering of the question make me think there is something wrong with it :(
  • 3. Re: Read Object Label
    Lyolik Newbie
    Currently Being Moderated
    Hi,

    Valentino wrote:
    The created objects also have "application" name. So how can I read it?
    You should read the specified file and find a tag 0x50 containing the application label.
  • 4. Re: Read Object Label
    Valentino Newbie
    Currently Being Moderated
    Hi,

    first I select the AID, then select the DODF, then :
    1. if I select the object file with
    new CommandAPDU(0x00, 0xA4, 0x00, 0x00, new byte [] {0x57, 0x01})
    //I get the FCI :
    6f 13 80 02 02 24 82 01 01 83 02 57 01 86 06 01 01 01 ff ff 01
    (I use this because i read the size of the object from the FCI).
    2. if I select the object file with
    new CommandAPDU(0x00, 0xA4, 0x04, 0x00 ) 
    //I get ( I tried to format it as I understand it from GlobalPlatform Card Specification v2.2.1 ):
    6f 65
         84 08 a0 00 00 00 03 00 00 00
         a5 59 9f 65 01 ff 9f 6e 06 47 91 81 02 31 00
              73 4a
                   06 07 2a 86 48 86 fc 6b 01
                   60 0c
                        06 0a 2a 86 48 86 fc 6b 02 02 01 01
                   63 09
                        06 07 2a 86 48 86 fc 6b 03
                   64 0b
                        06 09 2a 86 48 86 fc 6b 04 02 15
                   65 0b 06 09 2b 85 10 86 48 64 02 01 03
                   66 0c 06 0a 2b 06 01 04 01 2a 02 6e 01 02
    Then I read the file in while loop with :
    // Read BINARY
    ResponseAPDU obj = ch.transmit( new CommandAPDU(0x00, 0xB0, offset, 0x00) );
    Well I am new to Java Card technology and I get confused while reading GlobalPlatform Card Specification, ISO 7816-4 and the documentation of JCOP.
    So, what am I doing wrong?
  • 5. Re: Read Object Label
    Lyolik Newbie
    Currently Being Moderated
    Hi,

    Valentino wrote:
    84 08 a0 00 00 00 03 00 00 00
    Try select that AID with command: 00 A4 04 00 08 a0 00 00 00 03 00 00 00

    and find a tag 0x50 containing the application label.
  • 6. Re: Read Object Label
    Valentino Newbie
    Currently Being Moderated
    Hi,

    If I try to select that AID after I select the object I get :
    new CommandAPDU(0x00, 0xA4, 0x00, 0x00, new byte [] {0x44, 0x07}); // select DODF
    new CommandAPDU(0x00, 0xA4, 0x04, 0x00); // here I gues I select the first object since I am not using FID
    new CommandAPDU(0x00, 0xA4, 0x04, 0x00, new byte[]{ 0x08, (byte)0xa0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 } ); // here i get SW=6a82 (File not found)
    If I try to select that AID before I select the object I get:
    new CommandAPDU(0x00, 0xA4, 0x04, 0x00, new byte[]{ 0x08, (byte)0xa0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 } ); // here i get SW=6a86 (Incorrect parameters (P1,P2))
    If I try to get the AID right after i select the applet AID I get:
    new CommandAPDU(0x00, 0xA4, 0x04, 0x00, new byte[]{ (byte)0xA0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35}); // select the applet AID
    new CommandAPDU(0x00, 0xA4, 0x04, 0x00, new byte[]{ 0x08, (byte)0xa0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 } ); // here i get SW=6700 (Wrong length)
    What am I doing wrong?
  • 7. Re: Read Object Label
    Umer Journeyer
    Currently Being Moderated
    Hi,

    What you mean by "Application name" of the object ? are you trying to get the File identifier of EF like for EF_iccid it is '2FE2' ?

    And the APDU : 00 A4 04 00 08 A000000003000000 is the command apdu to select the card manager AID and nothing to do with file system. If you are dealing with SIM card and trying to access file system then you must select your default SIM application which i think you are doing correctly as shows your question.
  • 8. Re: Read Object Label
    Valentino Newbie
    Currently Being Moderated
    The card is NXP JCOP v2.4.1 and is initialized in PKCS15 profile.

    So when I create data object using my GUI Manager I have to enter "Label name" and "Application name" string fields /shown on the picture [url http://dox.bg/files/dw?a=db624b616a]HERE / which is different than the applet AID!
    Umer I think the answer to your question is no, I am not trying to get the File identifier /FID/ of EF, I already have the data object FID's.
    I hope from the picture of creating an object you will get my point.

    Thank you

    Edited by: Valentino on Sep 24, 2012 3:56 AM
  • 9. Re: Read Object Label
    Umer Journeyer
    Currently Being Moderated
    Ok well it is something new for me too :) but above discussion is not related to your problem. can you tell me what will happen when you click on the OK button ? can you thin these (label, application) are only for this tool to manage data for you and it has nothing to do with the actual data which you want to store on card ?

    Regards
    Umer
  • 10. Re: Read Object Label
    Valentino Newbie
    Currently Being Moderated
    When OK button is pressed the new object just appear in data file as shown [url http://dox.bg/files/dw?a=7034d87953]HERE.
    I think these (label, application) are NOT only for this tool and HAS something to do with the actual data stored on the card. What make me think that is : if I use CryptoVision dll to connect to the PKCS11 token I can read the stored objects as "iaik.pkcs.pkcs11.objects.Data" and then there is a method "getLabel()" which gives me these specific names!!! The Class in question you can see [url http://javadoc.iaik.tugraz.at/pkcs11_wrapper/current/iaik/pkcs/pkcs11/objects/Data.html]HERE. Please correct me if you think I am not right.
    So how you think these labels can be readed?
    Thank you
  • 11. Re: Read Object Label
    Valentino Newbie
    Currently Being Moderated
    From PKCS#11 specification shown [url ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-30/pkcs-11v2-30b-d6.pdf]HERE, Chapter 10 Objects, Figure 5 Object Attribute Hierarchy, you can see the attributes I am talking about. Specifically Data object has "Application" attribute and inherit "Label" attribute from Storage. I hope it is clear what values of the data object I am trying to read with APDU command.
    Best Regards
  • 12. Re: Read Object Label
    Valentino Newbie
    Currently Being Moderated
    Hi, I am still looking for the answer for getting these label names! If any have any reference for doing this , could you please let me know.
    Thank you
  • 13. Re: Read Object Label
    Valentino Newbie
    Currently Being Moderated
    I found the answer. The labels are in the EF and not in the data file itself. When I read the EF with Read Record command like
    ch.transmit( new CommandAPDU(0x00, 0xB2, 0x01, 0x04) );
    the response is
    01 2c 30 2a 30 0c 0c 06 49 64 4c 69 6e 6b 03 02 06 c0 30 07 0c 05 42 47 65 49 44 a1 11 30 0f 04 06 3f 00 50 15 57 01 02 01 00 80 02 02 4f 
    Where I can find the explanation of the response data field tags? I have read Global Platform 2.2 specification, but command READ REACORD is not therre. In my case I know that the label is 49 64 4c 69 6e 6b
    Thank you

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points