Hello all,

There is a bug/feature in the CardID constructor of OCF 1.1.

When the inserted card is f.e. a memory card with a synchronous ATR that
does not conform to ISO 7816, the constructor in CardID hangs up.

This could easily be fixed to support other ATRs by not retrieving the
historical bytes when ATR is non-conformant :

-----------------
  public CardID (byte[] answerToResetResponse)
    throws CardTerminalException {

    atr = (byte[]) answerToResetResponse.clone();
    // ... assert minimum length: TS + T0 character must be present
    if (atr.length < 2)
      throw new CardTerminalException
        ("Illegal ATR response (length " + atr.length +
         " < 2): " + HexString.hexify(answerToResetResponse));

// FIX
        // THIS OUTER "if" ADDED BY CARLES BARROB�S
        if ((atr[0] == 0x3B) || (atr[0] == 0x3F)) // check if ISO
asynchronous ATR
        {
// ENDFIX
                if ((atr[1] & 0x0f) > 0)
                {
                  historicals = new byte[atr[1] & 0x0f];

                  // retrieve the historical bytes
                  System.arraycopy(atr, atr.length - 1 - historicals.length,
                                                   historicals, 0,
historicals.length);
                  int histCtr = historicals.length-1;
                }
// FIX
        }
// ENDFIX
  }
---------------

The program I am designing right now is called CardInfo. It gives me as much
info as possible of the chip by identifying the ATR and other features based
in a "InfoCardService". I am planning to support memory cards (at least ATR
retrieval), therefore I had to introduce the mentioned fix. Could this type
of fix be added to further releases of OCF?

Thanks,
C A R L E S
---
  Carles Barrob�s i Meix 
  Marketing & Development
  GyD Ib�rica - Giesecke & Devrient
  Ind�stria 5
  E-08970 St. Joan Desp� 
  Tel +(34) 934808303  Fax +(34) 934771142
  mailto:[EMAIL PROTECTED]  http://www.gyd.com/


Visit the OpenCard Framework's WWW site at http://www.opencard.org/ for
access to documentation, code, presentations, and OCF announcements.
-----------------------------------------------------------------------------
To unsubscribe from the OCF Mailing list, send a mail to
"[EMAIL PROTECTED]" with the word "unsubscribe" in the BODY of the
message.

Reply via email to