0

I use this sample code for apdu connection. When i run this code, ı got BAD AID exception. Is there anybody who get this error message before?

  APDUConnection acn = null;
  try{
   //Create an APDUConnection object
   acn = (APDUConnection)
   Connector.open(“apdu:0;target=A0.0.0.67.4.7.1F.3.2C.3”);
   // Send a command APDU and receive response APDU
   responseAPDU = acn.exchangeAPDU(commandAPDU);
   ...
  } catch (IOException e) {
   ...
  } finally {
   ...
   if(acn != null) {
    // Close connection
    acn.close();
   }
   ...
  }
 ...
Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
yasinkafadar
  • 229
  • 1
  • 12

1 Answers1

0

You don't have a code sample, it's only a copy of the APDUConnection class reference: http://www.blackberry.com/developers/docs/7.1.0api/

The AID in the documentation example is just an example: Most likely, it does not match the AID (application id) in your smart card.

If you don't know the AID, use "SAT" as the target:

acn = (APDUConnection)  Connector.open("apdu:0;target=SAT");

I hope this helps.

Bamaco
  • 592
  • 9
  • 25