To quote an old message on the OCF mail archive at http://www.opencard.org/archive/opencard/0182.html:

The software stack is as follows:

OCF java code:
OCF native DLL: OCFPCSC1.DLL
MS generic smartcard support: WINSCARD.DLL
READER specific PCSC Driver DLL

Error 57 is not a return code specified by the PCSC I/F definition and thus the
semantic can not be explained without debugging the problem.
The error is returned from the READER specific PCSC Driver, probably as a result of a Microsoft system call that this reader is using.
winerror.h defines


//
// MessageId: ERROR_ADAP_HDW_ERR
//
// MessageText:
//
// A network adapter hardware error occurred.
//
#define ERROR_ADAP_HDW_ERR 57L


So it looks like a problkem with the reader driver.

[EMAIL PROTECTED] wrote:

We are developing Java Card project.

We are using Swing for Host Application, JCDK for Card Applets, & OCF
for interfacing.

We are using GXP211_PK card.

We are able to connect to card, but when when we send some data to card,
it returns some PcscException with 00000057 as code.

We are stuck here !!

Can somebody help us out ?



Following is the code :

public class OCFConnection  {

 private Pcsc10CardTerminal cardTerminal;    //represents card reader

  private static final int IFD_TIMEOUT = 10;

public PassThruCardService commService; //represents communication
channel
private int n; //temporary counter.
private int intATR; //represents int form of ATR.
private byte[] cardATR; //represents ATR returned by card.
private CommandAPDU commandAPDU; //represents instruction & data to
be sent to reader.
//----------------------------------------------------------------------
--------------------------------------------------


public OCFConnection () {
// get system properties
Properties systemProperties = System.getProperties ();
// set system properties for OCF, PC/SC and PassThruCardServce
systemProperties.put ("OpenCard.terminals",
"com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminalFactory");
systemProperties.put
("OpenCard.services","opencard.opt.util.PassThruCardServiceFactory");
}
//----------------------------------------------------------------------
--------------------------------------------------


  public void initOCF ()
 {
  // represents specimen APDU.
  byte[]  apduContents = {(byte)0,(byte)164,(byte)4,(byte)0,(byte)7,
              (byte)160,(byte)0,(byte)0,(byte)0,(byte)24,
              (byte)67,(byte)77,(byte)0
  };
  commandAPDU = new CommandAPDU (apduContents);

  try
  {
   SmartCard.start ();

   CardTerminalRegistry cardTerminalRegistry =
CardTerminalRegistry.getRegistry ();

   cardTerminal =
(Pcsc10CardTerminal)cardTerminalRegistry.cardTerminalForName ("Gemplus
GemPC430 0");

   CardRequest cardRequest = new CardRequest (CardRequest.ANYCARD, null,
PassThruCardService.class);
   cardRequest.setTimeout (IFD_TIMEOUT);  // set timeout for IFD
   System.out.println ("wait for smart card - insert smart card in
terminal");

    // wait  for a smart card inserted into the terminal
    SmartCard smartCard = SmartCard.waitForCard (cardRequest);

    if (smartCard != null)
    {  // no error occur and a smart card is in the terminal
          commService = (PassThruCardService) smartCard.getCardService
(PassThruCardService.class, true);

          String stringATR = new String ();

          System.out.print ("ATR:           ");
          CardID cardID = smartCard.getCardID ();
          cardATR = cardID.getATR ();

          for (n=0; n< cardATR.length; n++) {
           intATR = (int) (0x000000FF & cardATR[n]);            // byte
to int conversion
             stringATR = Integer.toHexString (intATR).toUpperCase ();
//String conversion

             if (stringATR.length () == 1) stringATR = "0" + stringATR;
              System.out.print(stringATR + " ");

          } // end of for

          System.out.println ("");
      }// end of if.

      System.out.println (commandAPDU.toString ());

     //obtain response from card
     ResponseAPDU responseAPDU = commService.sendCommandAPDU
(commandAPDU);

     System.out.println (responseAPDU.sw1 ());
     System.out.println (responseAPDU.sw2 ());

     smartCard.close ();
     SmartCard.shutdown ();
  }

  catch (CardTerminalException e)
  {
   System.out.println (e.getMessage ());
  }

  catch (Exception e)
  {
   System.out.println (e.getMessage ());
  }

  finally
  {
   String errorMsg = PcscError.getMessage ((int)57);

System.out.println (errorMsg);
}
}
//----------------------------------------------------------------------
--------------------------------------------------


 public static void main (String args[]) {
  OCFConnection siObject = new OCFConnection ();
  siObject.initOCF ();
 }



Awadhoot Aphale


---

Visit the OpenCard web site at http://www.opencard.org/ for more
information on OpenCard---binaries, source code, documents.
This list is being archived at http://www.opencard.org/archive/opencard/


! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
! [EMAIL PROTECTED]
! containing the word
! unsubscribe ! in the body.






--
------------------------------------------------------------------
 Brian McGuiness                          Phone: +44(0)1355 272911
 Senior Software Engineer                   Fax: +44(0)1355 272993
 Ecebs Limited
 The James Watt Building,
 Scottish Enterprise Technology Park,
 East Kilbride
 G75 0QD                           Email: [EMAIL PROTECTED]
 United Kingdom                    Internet:  http://www.Ecebs.com

 This email is only for the use of the addressee.  It may contain
 information which is legally privileged, confidential and exempt
 from disclosure.  If you are not the intended recipient you are
 hereby notified that any dissemination, distribution, or copying
 of this communication and its attachments is strictly prohibited.
------------------------------------------------------------------


---
Visit the OpenCard web site at http://www.opencard.org/ for more
information on OpenCard---binaries, source code, documents.
This list is being archived at http://www.opencard.org/archive/opencard/

! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
! [EMAIL PROTECTED]
! containing the word
! unsubscribe ! in the body.




Reply via email to