Hi * ,
I have a problem while getting the PIN from a user.
I use the following code to get the PIN as a string:
System.out.println("*** PLEASE ENTER YOUR 8-digit PIN for SmartCard Initialisation :");
DefaultCHVDialog pinDialog = new DefaultCHVDialog();
String pinString = pinDialog.getCHV(1);
System.out.println("Your PIN is: "+pinString);
byte [] myPIN = pinString.getBytes();
and the following to write it to a file:
// CREATE THE SECRET CODE FILE
System.out.println("\nCreating Secret Code File " + ef_D003);
fus.createSecretCodeFile(ef_D003, 1, null);
// Load Secret Code
GPKSecretCodeRef unlockRef = new
GPKSecretCodeRef(GPKSecretCodeRef.LOCAL_CODE, (byte)0x00);
System.out.println("\nLoading Secret Code in " + ef_D003);
fus.importSecretCode( ef_D003, // file
pinNumber, // pin
0, // code number
fus.PLAIN_PRESENTATION, //mode
3, //failures
unlockRef);
however I get an "Incorrect secret code length"
opencard.core.service.CardServiceInvalidParameterException: Incorrect secret code
length
at
com.gemplus.opencard.service.gpk.file.GPKFileUtilityService.importSecretCode(GPKFileUtilityService.java:212)
which is propably because the string.getBytes() method produces more bytes
than the 4 needed for fus.importSecretCode() thing.
Now is there a way to make this conversion with OCF or any other way ?
While searching I found public abstract interface CHVEncoder interface.
byte[] encodeCHV(java.lang.String chv)
Transform a Java String into a byte array suitable for the verification command.
However there is is stated:
STRING_ENCODING
public static final java.lang.String STRING_ENCODINGString encoding; that
is, use the String.getBytes() method. This is only an intermediate
solution.
question 2.
I use the defaultDialog. From OCF documentation I saw that the terminal
should be automatically recognized and a) if the terminal has a display
then the dialog takes place into terminal's display, b) if no
display/keypad then we use the computer.
I have tested this (I only changed the terminals) with GemPC410 and
GemSelf-MS700 ... but this didnt work ...
question 3.
Can someone tell me where I can find the list of access code values and
their meaning?
e.g.
byte[] ac = {(byte)0, (byte)0, // Update - Not Protected
(byte)0, (byte)0, // Write - Not Protected
(byte)0x40, (byte)0x81 //Read - Local Level Protected
};
I suppose there is a standard for these things .. right ?
Thanks for any hints :)
Regards,
Akis
---
> 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.