OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: CSE KITS (kitscseYAHOO.COM)
Date: Sat Jan 12 2002 - 04:11:45 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Hi all,
        I am getting the following error code of Scard
    Transmit.
        6F9h whenever I am trying to do a Read Binary
        (APDU = 00 b0 84 0 5 ) after a Write Binary
    command
        on my card. Can anyone explain what it means?
        Interestingly, I don't get the error message, if I
    give the Read Binary command before I
        Also sometimes I am getting the following status
    code, 0x8010002Fh, whenever the card returns some
    error status bytes( but not always).
        Is there a function, which prints the error
    message, given the status code.
        I am attaching part of the program code, that I am
    using (taken from gemplus code).

    thanks a lot,
    regards,
    ravi.

    /*------------------------------------------------------------------------------
          SCARDTRANSMIT
    ------------------------------------------------------------------------------*/
          case 1:
             printf("S C A R D T R A N S M I T\n");
    /*------------------------------------------------------------------------------
             Read CLA, INS, P1, P2, Lin
    ------------------------------------------------------------------------------*/
             dwLengthIn = 0;
             printf("\tCLA:");scanf("%x",&nData);
    szDataIn[dwLengthIn++] = (BYTE) nData;
             printf("\tINS:");scanf("%x",&nData);
    szDataIn[dwLengthIn++] = (BYTE) nData;
             printf("\tP1 :");scanf("%x",&nData);
    szDataIn[dwLengthIn++] = (BYTE) nData;
             printf("\tP2 :");scanf("%x",&nData);
    szDataIn[dwLengthIn++] = (BYTE) nData;
             nLenIn = 0;
             printf("\tLin:");scanf("%x",&nData);
    /*------------------------------------------------------------------------------
             Read Data In
    ------------------------------------------------------------------------------*/
             if (
                 (
                   (dwProtocol == SCARD_PROTOCOL_T0) &&
                   (nData > 0)
                 )
                 ||
                 (dwProtocol == SCARD_PROTOCOL_T1)
                )
             {
                szDataIn[dwLengthIn++] = (BYTE) nData;
                nLenIn = nData;
             }
             if (nLenIn != 0)
             {
                for (dwIndex=0;dwIndex < (DWORD)
    nLenIn;dwIndex++)
                {
                   printf("\t\tData[%d]:",dwIndex );
                   scanf("%x",&nData);
                   szDataIn[dwLengthIn++] = (BYTE) nData;
                }
             }
    /*------------------------------------------------------------------------------
             Read Lex
    ------------------------------------------------------------------------------*/
             if (
                 (
                   (dwProtocol == SCARD_PROTOCOL_T0) &&
                   (nLenIn == 0)
                 )
                 ||
                 (dwProtocol == SCARD_PROTOCOL_T1)
                )
             {
                printf("\tLex:");scanf("%x",&nData);
    szDataIn[dwLengthIn++]=nData;
                nLenOut = nData;
             }
    /*------------------------------------------------------------------------------
             If Lin=Lex=0, the P3 byte is not send.
    ------------------------------------------------------------------------------*/
             if ((nLenIn == 0) && (nLenOut == 0))
             {
                dwLengthIn = 4;
             }
             else
             {
                if (nLenOut == 0)
                {
                   dwLengthIn--;
                }
             }
             dwLengthOut = 200;
             ScardIoRequest.dwProtocol = dwProtocol;
             ScardIoRequest.cbPciLength =
    sizeof(ScardIoRequest);
             lRet = SCardTransmit(
                               hCard,
                                                             &ScardIoRequest,
                                                             szDataIn,
                                                             dwLengthIn,
                                                             NULL,
                                                             szDataOut,
                                                             &dwLengthOut
                               );
             bCommand = TRUE;
    /*
       SOME OTHER CODE HERE */

          if (bCommand)
          {
             printf("Status: %Xh\n",lRet);
                  if ((lRet == SCARD_S_SUCCESS) && (dwLengthOut
    >0))
                  {
                printf("Card response(%d):
    ",dwLengthOut);
                for
    (dwIndex=0;dwIndex<dwLengthOut;dwIndex++)
                {
                   printf("%02X,",szDataOut[dwIndex]);
                }
             }
             printf("\n");
          }

    __________________________________________________
    Do You Yahoo!?
    Send FREE video emails in Yahoo! Mail!
    http://promo.yahoo.com/videomail/