I am new to smartcard programming and need a little help.
I have a GCR500 terminal and GPK8000 cards. The cards are brand new - no one
has touched them other than myself. The test programs that come with the
OCF download work so I know that everything is set up properly from a
configuration standpoint.
My end goal is to try to create a file on the card, fill it with data, and
then read it back. I am using the examples in the OCF Programmer's Guide as
a...well...guide.
My problem comes when I try to create a transparent file on the card. I get
the following error message:
opencard.opt.service.CardServiceMissingCredentialsException: No proper
credentials available
at
com.gemplus.opencard.service.gpk.access.GPKCardAccessor.secureTheSession
at
com.gemplus.opencard.service.gpk.access.GPKCardAccessor.executeCommand
at com.gemplus.opencard.service.gpk.file.GPKFileSystemService.create
at com.gemplus.opencard.service.gpk.file.GPKFileUtilityService.createEF
at
com.gemplus.opencard.service.gpk.file.GPKFileUtilityService.createTransparen
tFile
at com.dataline.smartcard.CreateFile.init(CreateFile.java:44)
at com.dataline.smartcard.CreateFile.main(CreateFile.java:70)
Here is the code for my attempt at writing:
// Get file service
GPKFileUtilityService facs = (GPKFileUtilityService)sc.getCardService(
GPKFileUtilityService.class,
true
);
// Construct filepaths to the file on the card we will be using.
CardFilePath rootFilePath = facs.getRoot();
CardFilePath userFilePath = new CardFilePath(rootFilePath);
userFilePath.append(new CardFilePath(":c009"));
CardFile rootFile = new CardFile(facs);
CardFile userFile = new CardFile(facs, userFilePath);
if (!rootFile.exists(new CardFilePath(":c009"))) {
facs.createTransparentFile(userFilePath, 20, null);
}
// Get a writer for the file.
CardFileWriter cfw = new CardFileWriter(userFile);
cfw.write("data");
cfw.flush();
cfw.close();
The exception occurs on the facs.createTransparentFile() call. I'm assuming
that I need to use some kind of key or secret code, but am unsure about the
process.
If this is the problem could someone give me a pointer to some docs (I've
already read the OCF Programmer's Guide and it didn't really clear anything
up) or fill me in on what I'm doing wrong?
Thanks
---
> 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.