|
|
@ -1,7 +1,10 @@ |
|
|
|
package com.cst.im30.utility; |
|
|
|
package com.cst.im30.utility; |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context; |
|
|
|
import android.content.Context; |
|
|
|
|
|
|
|
import android.util.Log; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings({"unused"}) |
|
|
|
@SuppressWarnings({"unused"}) |
|
|
@ -15,10 +18,20 @@ public class NRICApduUtils { |
|
|
|
return IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectJpn); |
|
|
|
return IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectJpn); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// JPN - 1 - 1
|
|
|
|
|
|
|
|
|
|
|
|
public static String getOriginalName(Context applicationContext) { |
|
|
|
public static String getOriginalName(Context applicationContext) { |
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x96, (byte) 0x00}; |
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x96, (byte) 0x00}; |
|
|
|
(byte) 0x96, (byte) 0x00 |
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x96}; |
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x03, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x96, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x96 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
@ -34,9 +47,17 @@ public class NRICApduUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static String getGMPCName(Context applicationContext) { |
|
|
|
public static String getGMPCName(Context applicationContext) { |
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x50, (byte) 0x00}; |
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x99, (byte) 0x00, (byte) 0x50, (byte) 0x00}; |
|
|
|
(byte) 0x50, (byte) 0x00 |
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x50}; |
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x99, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x50, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x50 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
@ -52,9 +73,17 @@ public class NRICApduUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static String getKPTName(Context applicationContext) { |
|
|
|
public static String getKPTName(Context applicationContext) { |
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x28, (byte) 0x00}; |
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0xE9, (byte) 0x00, (byte) 0x28, (byte) 0x00}; |
|
|
|
(byte) 0x28, (byte) 0x00 |
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x28}; |
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0xE9, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x28, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x28 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
@ -70,9 +99,17 @@ public class NRICApduUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static String getIDNum(Context applicationContext) { |
|
|
|
public static String getIDNum(Context applicationContext) { |
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x0D, (byte) 0x00}; |
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x11, (byte) 0x01, (byte) 0x0D, (byte) 0x00}; |
|
|
|
(byte) 0x0D, (byte) 0x00 |
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x0D}; |
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x11, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x0D, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x0D |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
@ -86,4 +123,636 @@ public class NRICApduUtils { |
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
return str; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getGender(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x01 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_Gender:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getOldIDNum(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x08, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1F, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x08, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x08 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_OldIDNum:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO date object, dunno how to convert
|
|
|
|
|
|
|
|
public static String getBirthDate(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x27, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x04 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_BirthDate:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getBirthPlace(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x19, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x2B, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x19, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x19 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_BirthPlace:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO date object, dunno how to convert
|
|
|
|
|
|
|
|
public static String getDateIssued(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x44, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x04 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_DateIssued:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getCitizenship(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x12, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x48, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x12, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x12 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_Citizenship:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getRace(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x19, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x5A, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x19, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x19 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_Race:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getReligion(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x0B, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x73, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x0B, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x0B |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_Religion:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getEastMalaysian(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x7E, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x01 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_EastMalaysian:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ?
|
|
|
|
|
|
|
|
public static String getRJ(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x02, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x7F, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x02, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x02 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_RJ:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ?
|
|
|
|
|
|
|
|
public static String getKT(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x02, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x81, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x02, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x02 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_KT:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ?
|
|
|
|
|
|
|
|
public static String getOtherID(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x0B, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x83, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x0B, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x0B |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_OtherID:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ?
|
|
|
|
|
|
|
|
public static String getCategory(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x8E, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x01 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_Category:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ?
|
|
|
|
|
|
|
|
public static String getCardVersion(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x8F, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x01 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_CardVersion:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO date object, dunno how to convert
|
|
|
|
|
|
|
|
public static String getGreenCardExpiry(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x90, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x04 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_GreenCardExpiry:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ?
|
|
|
|
|
|
|
|
public static String getGreenCardNationality(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x14, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x94, (byte) 0x01, |
|
|
|
|
|
|
|
(byte) 0x14, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x14 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_GreenCardNationality:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// JPN - 1 - 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static byte[] getPhoto(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte)0xC8, (byte)0x32, (byte)0x00, (byte)0x00,(byte)0x05, (byte)0x08, (byte)0x00, (byte)0x00, |
|
|
|
|
|
|
|
(byte)0xA0, (byte)0x0F // Length - 4000 Little-Endian
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte)0xCC, (byte)0x00, (byte)0x00, (byte)0x00,(byte)0x08, |
|
|
|
|
|
|
|
(byte)0x02, (byte)0x00, (byte)0x01, (byte)0x00, // JPN-1-2
|
|
|
|
|
|
|
|
(byte)0x03, (byte)0x00, // Offset - Little-Endian
|
|
|
|
|
|
|
|
(byte)0xA0, (byte)0x0F // Length - 4000 Little-Endian
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte)0xCC, (byte)0x06, (byte)0x00, (byte)0x00, |
|
|
|
|
|
|
|
(byte)0xFF // Read Length - 255
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByteFinal = new byte[]{(byte)0xCC, (byte)0x06, (byte)0x00, (byte)0x00, |
|
|
|
|
|
|
|
(byte)0xAF // Read Length 175
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
int fullReads = (int) Math.floor((double)4000 / (double)255); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < fullReads; i++) { |
|
|
|
|
|
|
|
byte[] tmp = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
byte[] finalTmp = Arrays.copyOfRange(tmp, 0 , tmp.length -2); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
outputStream.write( finalTmp ); |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
|
|
Logger.logE(Log.getStackTraceString(e)); |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
byte[] tmp = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByteFinal); |
|
|
|
|
|
|
|
byte[] finalTmp = Arrays.copyOfRange(tmp, 0 , tmp.length -2); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
outputStream.write( finalTmp ); |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
|
|
Logger.logE(Log.getStackTraceString(e)); |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return outputStream.toByteArray(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// JPN - 1 - 4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getAddress1(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x03, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_Address1:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getAddress2(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x21, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_Address2:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getAddress3(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x3F, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_Address3:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO postcode object, dunno how to convert
|
|
|
|
|
|
|
|
public static String getPostcode(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x03, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x5D, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x03, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x03 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_Postcode:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getCity(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x19, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x60, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x19, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x19 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_City:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getState(Context applicationContext) { |
|
|
|
|
|
|
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, |
|
|
|
|
|
|
|
(byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x79, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E, (byte) 0x00 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, |
|
|
|
|
|
|
|
(byte) 0x1E |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
|
|
|
|
|
|
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
|
|
|
|
|
|
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String str = new String(trimmedBytes).trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.logD("JPN_State:" + str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|