Problem with smart card. Return code = 80100066 Need help desperately
Hi guys !
Im recently having hell of a time communicating with my smart card reader. I have the towitoko reader 'CHIPDRIVE micro 130 V4.30'. I have installed its drivers and every time i run the TestResMan diagnostic tool, everything works fine.
I have also downloaded the OCF, installed it, and im trying to communicate with the reader. My code looks like :
package cardapp;
/**
*
* @author evsav
*/
import opencard.core.service.SmartCard;
import opencard.core.service.CardRequest;
import opencard.opt.iso.fs.FileAccessCardService;
import opencard.opt.iso.fs.CardFile;
public class ReadFile {
public static void main(String[] args) {
System.out.println("reading smartcard file...");
try {
SmartCard.start();
// wait for a smartcard with file access support
CardRequest cr =
new CardRequest(CardRequest.NEWCARD, null, FileAccessCardService.class);
SmartCard sc = SmartCard.waitForCard(cr);
FileAccessCardService facs = (FileAccessCardService) sc.getCardService(FileAccessCardService.class, true);
CardFile root = new CardFile(facs);
CardFile file = new CardFile(root, ":c009");
byte[] data = facs.read(file.getPath(), 0, file.getLength());
sc.close();
String entry = new String(data);
entry = entry.trim();
System.out.println(entry);
} catch (Exception e) {
e.printStackTrace(System.err);
} finally { // even in case of an error...
try {
SmartCard.shutdown();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
System.exit(0);
}
}
I have placed the opencard.properties file into C:\Java\jdk1.6.0_04\jre\lib. Here it is:
# Configuring the CardServiceRegistry
OpenCard.services = com.ibm.opencard.factory.MFCCardServiceFactory
# Configuring the CardTerminalRegistry
# The parameters after the class name are:
# name, type, and address of the card terminal
OpenCard.terminals = com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminalFactory
#com.ibm.opencard.terminal.pcscmig.PcscMigCardTerminalFactory
# Configuring Tracing
OpenCard.trace = opencard.core:6 opencard.opt:0 com.ibm.opencard:3 \
com.ibm.opencard.terminal.ibm5948.IBM5948CardTerminal:8 opencard.core:3 opencard.core:8 opencard.core:4
As i read, the file 'readers.cfg ' is not necessary as long as i use the Pcsc10CardTerminalFactory as a terminal which i assume is the correct for my reader. Having set the debug mode ON when i run the program i get the following lines (a part of them)
[DEBUG ] opencard.core.service.CardServiceRegistry.getSmartCard
--- message CTEvent opencard.core.event.CardTerminalEvent[source=com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal@c20e24
+ name SCM Microsystems Inc. CHIPDRIVE USB SmartCardReader 0
+ type PCSC10
+ addr ]
---source com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal@c20e24
+ name SCM Microsystems Inc. CHIPDRIVE USB SmartCardReader 0
+ type PCSC10
+ addr
---id 1
card inserted in slot 0
terminal com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal@c20e24
+ name SCM Microsystems Inc. CHIPDRIVE USB SmartCardReader 0
+ type PCSC10
+ addr
--- thread Thread[Thread-0,5,main]
--- source opencard.core.service.CardServiceRegistry@1050e1f++ registered factory com.ibm.opencard.factory.MFCCardServiceFactory@174cc1f
[DEBUG ] com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal.openSlotChannel
--- message for slot #0
--- thread Thread[Thread-0,5,main]
--- source com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal@c20e24
+ name SCM Microsystems Inc. CHIPDRIVE USB SmartCardReader 0
+ type PCSC10
+ addr
and the flow control stops here waiting for me to insert a card. When i insert the card into the reader i get the following exception
opencard.core.terminal.CardTerminalException: Pcsc10CardTerminal: PCSC Exception in method SCardConnect: PC/SC Error SCardConnect
return code = 80100066
[ERROR ] com.ibm.opencard.terminal.pcsc10.OCFPCSC1.OCFPCSC1.SCardConnect
--- message PCSC Exception in method SCardConnect: PC/SC Error SCardConnect
return code = 80100066
--- thread Thread[Thread-0,5,main]
at com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal.translatePcscException(Pcsc10CardTerminal.java:502)
--- source com.ibm.opencard.terminal.pcsc10.OCFPCSC1@1027b4d
[DEBUG ] opencard.core.event.EventGenerator.updateCards
--- message notified CTListeners
at com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal.cardConnect(Pcsc10CardTerminal.java:361)
--- thread Thread[Thread-0,5,main]
--- source class opencard.core.event.EventGenerator
at com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal.internalOpenSlotChannel(Pcsc10CardTerminal.java:315)
at opencard.core.terminal.CardTerminal.openSlotChannel(CardTerminal.java:385)
at opencard.core.service.CardServiceRegistry.getSmartCard(CardServiceRegistry.java:316)
at opencard.core.service.SmartCard.getSmartCard(SmartCard.java:388)
at opencard.core.service.CardWaiter.cardInserted(CardWaiter.java:98)
at opencard.core.event.EventGenerator.updateCards(EventGenerator.java:233)
at opencard.core.terminal.CardTerminalRegistry.cardInserted(CardTerminalRegistry.java:281)
[DEBUG ] opencard.core.service.SmartCard.<shutdown>
at opencard.core.terminal.CardTerminal.cardInserted(CardTerminal.java:577)
--- message shutdown OpenCard
--- thread Thread[main,5,main]
--- source class opencard.core.service.SmartCard
at com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal.poll(Pcsc10CardTerminal.java:493)
[DEBUG ] opencard.core.terminal.CardTerminalRegistry.remove
at opencard.core.event.EventGenerator.run(EventGenerator.java:199)
--- message closing com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminal@c20e24
at java.lang.Thread.run(Thread.java:619)
and the rest of the remaining debug lines.
Can pls anyone tell me what does 'return code = 80100066' mean?
Thanks in advance
evsav