/** * Returns Last Numbers Dialed in human readable interpretation. * * @param position Entry position of LND that is to be read. * @param showAllHex if true, returns HEX representation of data. If false, returns normal * representation of data. * @return Last Numbers Dialed in human readable interpretation. */ public String getLNDString(int position, boolean showAllHex) { byte[] LND = null; String LNDString = ""; String contactName = ""; try { worker.getResponse(worker.select(DatabaseOfEF.DF_TELECOM.getFID())); LND = worker.readRecord( position, worker.getResponse(worker.select(DatabaseOfEF.EF_LND.getFID()))); contactName = contactName.concat(Converter.bytesToHex(LND).substring(0, 3 * (LND.length - 14))); if (!contactName.matches("[FF ]+")) { for (int i = 0; i < LND.length - 14; i++) { LNDString = LNDString.concat(Character.toString((char) (int) LND[i])); } LNDString = LNDString.concat("; "); } if (LND[LND.length - 14 + 1] == (byte) 0x91) { LNDString = LNDString.concat("00"); } for (int i = LND.length - 14 + 2; i <= LND.length - 14 + LND[LND.length - 14]; i++) { String b = Converter.byteToHex(LND[i]); String c = Converter.swapString(b); LNDString = LNDString.concat(c); } } catch (Exception ex) { Logger.getLogger(CardManager.class.getName()).log(Level.SEVERE, null, ex); } if (showAllHex) { return Converter.bytesToHex(LND); } else { return LNDString; } }
/** * Returns GPRS Ciphering Key in HEX. * * @return GPRS Ciphering Key in HEX. */ public String getKCGPRSKeyString() { byte[] input = getEFBytes(DatabaseOfEF.EF_KCGPRS); byte[] KC_KEY = new byte[9]; System.arraycopy(input, 0, KC_KEY, 0, 9); return Converter.bytesToHex(KC_KEY); }
/** * Returns Mobile Station ISDN Number (telephone number of given SIM card) * * @param position Entry position of MSISDN that is to be read. * @param showAllHex if true, returns HEX representation of data. If false, returns normal * representation of data. * @return Mobile Station ISDN Number (telephone number of given SIM card) in human readable * interpretation. */ public String getMSISDNString(int position, boolean showAllHex) { byte[] MSISDN = null; String MSISDNString = ""; try { worker.getResponse(worker.select(DatabaseOfEF.DF_TELECOM.getFID())); MSISDN = worker.readRecord( position, worker.getResponse(worker.select(DatabaseOfEF.EF_MSISDN.getFID()))); if (MSISDN[14] != (byte) 0xff) { for (int i = 16; i <= 14 + MSISDN[14]; i++) { String b = Converter.byteToHex(MSISDN[i]); String c = Converter.swapString(b); MSISDNString = MSISDNString.concat(c); } } } catch (Exception ex) { Logger.getLogger(CardManager.class.getName()).log(Level.SEVERE, null, ex); } if (showAllHex) { return Converter.bytesToHex(MSISDN); } else { return MSISDNString; } }
/** * Returns Answer To Reset in HEX. * * @return Answer To Reset in HEX. */ public String getATR() { byte[] ATR = new byte[CardManager.m_ATR.length - 2]; System.arraycopy(CardManager.m_ATR, 0, ATR, 0, CardManager.m_ATR.length - 2); return Converter.bytesToHex(ATR); }