Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User wobbly101's Avatar
    Join Date
    Nov 2007
    Posts
    10
    Im trying to connect to the internal secure element on the Nokia 6131, a collegue (who has now left) of mine wrote an application that connected to the internal chip on the Nokia 3220 using SecureChipConnection, but this doesnt work on the Nokia 6131, anyone know how to do the equivilent on the Nokia 6131. The application can read balance from the card, and can write a balance to the card. The code used for the 3220 is as follows:

    SecureChipConnection mScConn = SecureChipConnection.openConnection(null, this);

    then to read a balance on the card:

    mScConn.setSCCMode(SCCMode.SC_INTERNAL, true, null, SecureChipConnection.NO_TIMEOUT);

    byte[] data = mScConn.exchangeAPDU(SELECT_ADPU);

    data = mScConn.exchangeAPDU(READ_BALANCE_APDU);


    and to write a balance to the card:

    mScConn.setSCCMode(SCCMode.SC_INTERNAL, true, null, SecureChipConnection.NO_TIMEOUT);

    byte[] data = mScConn.exchangeAPDU(SELECT_ADPU);

    mScConn.exchangeAPDU(WRITE_BALANCE_APDU);


    Ive tried using ISO14443Connection instead, doing:

    String uri = System.getProperty("internal.se.url");
    conn = (ISO14443Connection)Connector.open(uri);


    but I get a ClassCastException when casting to the ISO14443Connection, the connection that Connector.open(uri) returns is of type ISO14443ConnectionImpl.

    Also, if this hurdle was overcome would the reading and writing of the READ_BALANCE_APDU and WRITE_BALANCE_APDU byte arrays work as the SecureChipConnection did?

    Thanks in advance,

    Daniel

    p.s. If im going about all this the wrong way then let me know! any suggestions are welcome.
    Last edited by wobbly101; 2007-11-05 at 14:14.

  2. #2
    Regular Contributor lovercjs's Avatar
    Join Date
    May 2007
    Posts
    63
    You will have to use the ISO14443Connection class that is supported in the N6131NFC

  3. #3
    Registered User wobbly101's Avatar
    Join Date
    Nov 2007
    Posts
    10
    Any idea why this:

    String uri = System.getProperty("internal.se.url");
    conn = (ISO14443Connection)Connector.open(uri);

    would cause a ClassCastException?

    I did this:

    String uri = System.getProperty("internal.se.url");
    Connection connection = Connector.open(uri);
    System.out.println(connection);
    conn = (ISO14443Connection)connection;

    which prints out:

    com.nokia.phone.ri.contactless.ISO14443ConnectionImpl@1cb37664

    And I dont know why Connector.open(uri) is returning an ISO14443ConnectionImpl rather than ISO14443Connection

    Daniel

  4. #4
    Regular Contributor lovercjs's Avatar
    Join Date
    May 2007
    Posts
    63
    Try this:

    ISO14443Connection conn = (ISO14443Connection)Connector.open(System.getProperty("internal.se.url"));

  5. #5
    Registered User wobbly101's Avatar
    Join Date
    Nov 2007
    Posts
    10
    Quote Originally Posted by lovercjs View Post
    Try this:

    ISO14443Connection conn = (ISO14443Connection)Connector.open(System.getProperty("internal.se.url"));
    No luck, i get a ClassCastException, its trying to cast a ISO14443ConnectionImpl to a ISO14443Connection.

    Daniel

  6. #6
    Registered User wobbly101's Avatar
    Join Date
    Nov 2007
    Posts
    10
    Does anybody know why this might happen?

    Connector.open(System.getProperty("internal.se.url"));

    is returning an ISO14443ConnectionImpl which when cast to an ISO14443Connection throws a ClassCastException

    Daniel

  7. #7
    Registered User wobbly101's Avatar
    Join Date
    Nov 2007
    Posts
    10
    This is the a cut down version of the code I am using to connect:

    NewSmartCard.java

  8. #8
    Registered User ant.pitel's Avatar
    Join Date
    Feb 2009
    Posts
    17
    Hello,

    I would like to know if it is possible to create an APDUConnection between a midlet and the SecureElement of the device?

    I tried to get the slot of the secure element in order to create the connection with :
    apduconn = (APDUConnection) Connector.open("apdu:"+slot+";target=" + HIGHCO_GENERIC_AID);

    But it works only in the method externalReaderDetected so when a reader is detected and I would like to open connection even if there's no reader in the neighborhood in order to call methods in the applet.

    Is anyone tried to do the same thing?

    Thanks for your help.

  9. #9
    Regular Contributor scc's Avatar
    Join Date
    Feb 2008
    Posts
    88
    Quote Originally Posted by ant.pitel View Post
    Hello,

    I would like to know if it is possible to create an APDUConnection between a midlet and the SecureElement of the device?

    I tried to get the slot of the secure element in order to create the connection with :
    apduconn = (APDUConnection) Connector.open("apdu:"+slot+";target=" + HIGHCO_GENERIC_AID);

    But it works only in the method externalReaderDetected so when a reader is detected and I would like to open connection even if there's no reader in the neighborhood in order to call methods in the applet.

    Is anyone tried to do the same thing?

    Thanks for your help.
    Hi,

    I am always getting -1 or 0xFF with externalReaderDetected(byte slot) event, what is the correct slot number to access SE over JSR 177? What slot number did you receive?

    The device that I am using is Nokia 6212 NFC.

    Many thanks in anticipation for your reply.
    Last edited by scc; 2010-03-10 at 00:30.

  10. #10
    Registered User ant.pitel's Avatar
    Join Date
    Feb 2009
    Posts
    17
    Hi,

    I finally gave up the method using the slot numbre of the SE.
    But I used an ISO14443Connection which worked very well. Here's my code :

    cardLink = (ISO14443Connection) Connector.open(System.getProperty("internal.se.url"));
    //Which open the connection
    answerAPDU= cardLink.exchangeData(APDUcommand);
    //send APDU command to the SE

    I hope this could help, I will have a look to the slot problem if I could

    Regards

  11. #11
    Regular Contributor scc's Avatar
    Join Date
    Feb 2008
    Posts
    88
    Hi,

    I can connect with ISO14443 connection as well. But I was trying with JSR 177 to talk to the SE, but as I mentioned with JSR 177 I am getting the same slot number (-1 or 0xFF) which stands for UNKNOWN_SLOT. I thought you said that you were able to discover the correct slot in the SE and access your "HIGHCO_GENERIC_AID" applet?

    I tried to get the slot of the secure element in order to create the connection with :
    apduconn = (APDUConnection) Connector.open("apdu:"+slot+";target=" + HIGHCO_GENERIC_AID);

    But it works only in the method externalReaderDetected so when a reader is detected and I would like to open connection even if there's no reader in the neighborhood in order to call methods in the applet.
    Please clarify. Thankyou.

    By the way, 6131 does not support JSR 177-APDU, but 6212 supports.

  12. #12
    Registered User ant.pitel's Avatar
    Join Date
    Feb 2009
    Posts
    17
    I didn't keep my file where I was trying to connect through slot number so I can't give you a correct answer before searching a bit. But as far as I remember, I had the same problem and got an useless slot like UNKNOWN_SLOT...

    Sorry for my limited help, I will answer you again if I find something else!

Similar Threads

  1. Nokia 6131 NFC and Secure Element of a MiFare SmartCard
    By j.delinselle in forum Near Field Communication
    Replies: 2
    Last Post: 2009-11-05, 08:56
  2. Nokia 6131 NFC Internal Secure Element
    By wobbly101 in forum Near Field Communication
    Replies: 1
    Last Post: 2007-11-05, 13:56
  3. Nokia Mobile VPN Client
    By marcyl in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2003-12-01, 14:47

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