1 Reply Latest reply: Nov 7, 2011 5:45 AM by 865727 RSS

    Connect and read from Smart Card ? How to ?

    898261
      Hi,

      how to handle smart cards , connecting , reading ...etc ?

      Is this sample code enough ? [Sample Code|http://www.mawj.net/vb/showthread.php?t=14691]

      I don't know how to start . can any body please provide me a guide to how to start by this and thanks in advance

      Edited by: 895258 on Nov 5, 2011 9:57 PM
        • 1. Re: Connect and read from Smart Card ? How to ?
          865727
          Hi, I do not know which Java package has the classes metioned on the link, but below is some sample code that worked for me:

          String url = "apdu:0;target=[javacard_application_id]";
          byte [] data = new byte[] { /*will be sent to javacard application*/ };
          APDUConnection ac = (APDUConnection) Connector.open(url); // from package javax.microedition.apdu, JSR 177

          data = ac.exchangeAPDU(data); // after this line 'data' will hold the response
          if (data[0] == 0x61) { // process completed, normal processing
          }