Commit 9777b5ba authored by Josh Ji's avatar Josh Ji

fix getShareableInterfaceObject() aid.equals() param;

getSharedPIN() return value;
getName() return value, file length check
parent 574170ce
......@@ -1121,7 +1121,7 @@ public class PassportApplet extends Applet implements ISO7816, SharePIN, ShareNa
@Override
public Shareable getShareableInterfaceObject(AID aid, byte b) {
if(aid.equals(new byte[]{(byte)0xa0,(byte)0x00,(byte)0x00,(byte)0x06,(byte)0x47,(byte)0x2f,(byte)0x00,(byte)0x01}, (short)0, (byte)0)){
if(aid.equals(new byte[]{(byte)0xa0,(byte)0x00,(byte)0x00,(byte)0x06,(byte)0x47,(byte)0x2f,(byte)0x00,(byte)0x01}, (short)0, (byte)8)){
return this;
}
return null;
......@@ -1138,13 +1138,13 @@ public class PassportApplet extends Applet implements ISO7816, SharePIN, ShareNa
public short getSharedPIN(byte[] apduBuffer, short offset) {
if(sharedPIN != null) {
Util.arrayCopy(sharedPIN, (short) 0, apduBuffer, offset, (short) sharedPIN.length);
return (short)(offset+sharedPIN.length);
return (short)sharedPIN.length;
}else{
if (birthDay != null && birthDay.length != 0) {
sharedPIN = new byte[birthDay.length];
Util.arrayCopy(birthDay, (short) 0, sharedPIN, (short)0, (short) birthDay.length);
Util.arrayCopy(sharedPIN, (short) 0, apduBuffer, offset, (short) sharedPIN.length);
return (short) (offset+sharedPIN.length);
return (short)sharedPIN.length;
} else {
return (short) -1;
}
......@@ -1163,8 +1163,15 @@ public class PassportApplet extends Applet implements ISO7816, SharePIN, ShareNa
@Override
public short getName(byte[] apduBuffer, short offset) {
// ICAO 9303 part 10, DG1 TD3 format, field:"Name of holder" offset:5 length:39
Util.arrayCopy(fileSystem.getFile(FileSystem.EF_DG1_FID), (short)5, apduBuffer, offset, (short)39);
return (short)(offset+39);
byte[] file = fileSystem.getFile(FileSystem.EF_DG1_FID);
if(file != null && file.length>(short)49) {
// ICAO 9303 part 10, DG1, 0x61||L(1byte)||0x5F1F||L(1byte)||DATA
// DATA:TD3 format, field:"Name of holder" offset:5 length:39
Util.arrayCopy(file, (short) (5+5), apduBuffer, offset, (short) 39);
return (short)39;
}else{
return -1;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment