Discussion Board

Results 1 to 5 of 5

Hybrid View

  1. #1
    Registered User Nabil_java's Avatar
    Join Date
    May 2008
    Posts
    17
    Hi All

    I am writing java application to talk with smart card (need to format my card)

    every thing is ok till i reach to this command:

    private static byte[] COMMAND2 = {(byte) 0xEF, (byte) 0xFA, (byte) 0xCE, (byte) 0x00, (byte) 0xFF};
    private static CommandAPDU COMMAND2_APDU = new CommandAPDU(COMMAND2);

    it is CARD RECYCLE COMMAND
    i use it to make format for my card


    //Code

    connectWithCard();

    sendAPDU1();

    card.disconnect(true); //Reset must occur before
    try{
    Thread.sleep(1000);
    }
    catch(InterruptedException e)
    {
    System.out.println("Exception for sleep : "+e.getMessage());
    }

    connectWithCard();

    ra=ch.transmit(COMMAND2_APDU);//Exception occur here
    System.out.println("Response due to COMMAND2_APDU : " + arrayToHex(ra.getBytes()));



    //implementation for connectwithCard()
    try {
    card = c.connect("T=0");
    // System.out.println("Terminal connected");
    } catch (Exception e) {
    // System.out.println("Terminal NOT onnected: " + e.toString());

    }

    System.out.println("ATR: " + arrayToHex(((ATR) card.getATR()).getBytes()));
    ch = card.getBasicChannel();





    Exception is:

    javax.smartcardio.CardException: sun.security.smartcardio.PCSCException: Unknown error 0x8010002f

    What should i do ?

    Thanks in Advance
    Last edited by Nabil_java; 2008-08-08 at 15:06.

  2. #2
    Regular Contributor geri-m's Avatar
    Join Date
    Apr 2004
    Location
    Vienna
    Posts
    321
    Hi Nabil,

    it looks like this not all code needed in order to reproduce your error (eg: what does connectWithCard();?). Secondly, please mention at which line the excpetion occurs.

    You can find a full example for establishing a connection to your PC/SC Reader here <http://wiki.forum.nokia.com/index.php/NFC_Secure_Element_Example_External_Reader>

    Please keep in mind that this requires
    (a) JSDK 6.0
    (b) Your contactless Reader to support PC/SC.

    Cheers, Geri-m

  3. #3
    Registered User robwhe's Avatar
    Join Date
    Feb 2011
    Posts
    1
    Quote Originally Posted by geri-m View Post
    Hi Nabil,

    it looks like this not all code needed in order to reproduce your error (eg: what does connectWithCard();?). Secondly, please mention at which line the excpetion occurs.

    You can find a full example for establishing a connection to your PC/SC Reader here <http://wiki.forum.nokia.com/index.php/NFC_Secure_Element_Example_External_Reader>

    Please keep in mind that this requires
    (a) JSDK 6.0
    (b) Your contactless Reader to support PC/SC.

    Cheers, Geri-m
    Hi Geri-m,

    I have downloaded the example mentioned above and opened it in NetBeans. I have an Omnikey Card Reader attached, which I am trying to use to connect to a smart card to retrieve a number from a smart card. I intend on using this number to run a query and retrieve information from a Database. When I run the program it seems to connect to the reader and even retrieves the number on the card but when it gets to line 80 (where the SELECT_APDU section begins), it skips down to line 111. It also displays an error of <PCSCException: Unknown error 0x1f
    debug:> A card exception error but yet I have established a connection and my number has been retreived. The full debug output is below, any help on resolving this error would be greatly appreciated.

    Updating property file: C:\Program Files (x86)\NetBeans 6.9.1\CardReader\ReaderApplication\build\built-jar.properties
    compile:
    List of PC/SC Readers connected:
    Reader: OMNIKEY CardMan 5x21 0
    Reader: OMNIKEY CardMan 5x21-CL 0
    Terminal fetched
    Terminal connected
    ATR: 3b8f8001804f0ca000000306030001000000006a
    Error isCardPresent()javax.smartcardio.CardException: sun.security.smartcardio.PCSCException: Unknown error 0x1f
    debug:
    BUILD SUCCESSFUL (total time: 2 minutes 23 seconds)

    P.S. Looking at the above output i wonder is it something to do with the fact the program is showing two cards, when in fact there is only one attached.
    Thanks in advance

  4. #4
    Regular Contributor geri-m's Avatar
    Join Date
    Apr 2004
    Location
    Vienna
    Posts
    321
    Hi Robwhe,

    strange. The Reader detectes the Card and prints the ATR (Answer to Request). But on selecting the system fails. What kind of cards/devices are you trying to read with the OK-Reader?

    best, Gerald

  5. #5
    Registered User mroland's Avatar
    Join Date
    Feb 2009
    Location
    Hagenberg, Austria
    Posts
    121
    Hallo,

    Quote Originally Posted by robwhe View Post
    ATR: 3b8f8001804f0ca000000306030001000000006a
    Translated according to PC/SC standard:
    3b ... PC/SC initial
    8f8001 ... T0|TD1|TD2
    80
    4f0c
    a000000306 ... RID for storage card
    03 ... ISO 14443-3 Type A
    0001 ... MIFARE Classic 1K
    00000000 ... RFU
    6a

    So the ATR you showed here suggests that you try to use a MIFARE Classic 1K card. This type of card is not APDU based but uses proprietary commands on a lower protocol layer (i.e. ISO 14443-3 Type A). Particularly it is no JavaCard.

    Best regards,
    Michael

Similar Threads

  1. illegal use of abstract class error...
    By kannabiran.krish in forum Symbian C++
    Replies: 7
    Last Post: 2007-08-17, 10:11
  2. ERROR RCmake.exe AND rcomp.exe
    By jifik in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2005-10-31, 12:24
  3. Replies: 3
    Last Post: 2005-09-13, 05:37
  4. Errors compilling and debugging Helloworld
    By doberlet in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2004-03-04, 18:08
  5. Codewarrior import .mmp error
    By serenade in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2004-02-21, 20:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved