Hi,
I faced problem whenever I try to access the master file in the smartcard.
Below is the error message:
java.lang.ClassNotFoundException: CardService implementing interface
opencard.opt.iso.fs.FileAccessCardService
at
opencard.core.service.CardServiceRegistry.getCardServiceInstance(CardService
Registry.java:269)
at
opencard.core.service.SmartCard.getCardService(SmartCard.java:331)
at com.abc.FileAccess.main(FileAccess.java:41)
The program will throw error at (Below is the complete code):
### FileAccessCardService facs =(FileAccessCardService)
card.getCardService(FileAccessCardService.class,true); ###
I really don't know why this happen and what should I do, please advice.
Actually I am new in SmartCard app, I have GemPlus 410 Card Reader, an 8k
card and running in windows 2000, I write code using JDK1.1.7.
Anohter thing is I wondering how can I find out my smartcard is memory card
or microprocessor card?
According to the supplier, there are certificate contain in the smartcard,
so I just wondering whether I can use FileAccessCardService to acces the
certificate information in the card or not, or I should use other way?
Your help is really appreciated.
Thanks
Regards
Ray
This is my code,
try {
SmartCard.start ();
CardRequest cr = new CardRequest (CardRequest.ANYCARD, null, null);
SmartCard card = SmartCard.waitForCard (cr);
if (card != null) {
try{
FileAccessCardService facs =(FileAccessCardService)
card.getCardService(FileAccessCardService.class,true);
CardFile root =new CardFile(facs);
CardFile file =new CardFile(root,":c009");
byte []data =facs.read(file.getPath(),0,file.getLength());
card.close();
String entry =new String(data);
entry =entry.trim();
System.out.println(entry);
}
catch(Exception e){
e.printStackTrace();
System.out.println("");
}
}
else
System.out.println ("Did not get a SmartCard object!");
}
catch (OpenCardPropertyLoadingException plfe) {
System.out.println ("OpenCardPropertyLoadingException: ");
System.out.println (plfe.getMessage () );
}
catch (ClassNotFoundException cnfe) {
System.out.println ("ClassNotFoundException: ");
System.out.println (cnfe.getMessage () );
}
catch (CardServiceException cse) {
System.out.println ("CardServiceException: ");
System.out.println (cse.getMessage () );
}
catch (CardTerminalException cte) {
System.out.println ("CardTerminalException: ");
System.out.println (cte.getMessage () );
}
finally{
try{
SmartCard.shutdown();
}
catch(Exception e){
System.out.println("Error in shutdown OCF " + e.toString());
}
}
---
> 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.