Updated on 2026-08-14

This commit is contained in:
Tangem 2018-09-07 11:28:10 +03:00
parent 5c6ea5ca04
commit ff6679eaad
11 changed files with 15 additions and 391 deletions

View file

@ -283,64 +283,6 @@ public class CardProtocol {
}
}
// send command APDU, get response APDU, and display HEX data to user
// private ResponseApdu SendAndReceive(CommandApdu cmdApdu, boolean breakOnNeedPause) throws Exception {
// if (mCard.encryptionMode != TangemCard.EncryptionMode.None) {
// if (sessionKey == null) {
// run_OpenSession(mCard.encryptionMode);
// }
// cmdApdu.Crypt(sessionKey);
// }
// cmdApdu.setP1(mCard.encryptionMode.getP());
// byte[] cmdBytes = cmdApdu.toBytes();
// String cmdStr = CommandApdu.toString(cmdBytes, cmdApdu.getLc());
// Log.v("NFC", String.format("<< [%s]: %s", cmdApdu.getCommandName(), cmdStr));
// byte[] rsp;
// ResponseApdu rspApdu;
// try {
// do {
// try {
// mNotifications.onReadBeforeRequest(mIsoDep.getTimeout());
// try {
// rsp = mIsoDep.transceive(cmdBytes);
// } finally {
// mNotifications.onReadAfterRequest();
// }
// } catch (IOException e) {
// if (e.getMessage().contains("length exceeds supported maximum") && mIsoDep.isExtendedLengthApduSupported()) {
// throw new TangemException_ExtendedLengthNotSupported(e.getMessage());
// }
// throw e;
// }
// if (mCard.encryptionMode != TangemCard.EncryptionMode.None) {
// rspApdu = ResponseApdu.Decrypt(rsp, sessionKey);
// } else {
// rspApdu = new ResponseApdu(rsp);
// }
//
// if (rspApdu.isParsedWithError()) {
// Log.v("NFC", String.format(">> [%s]: %s", cmdApdu.getCommandName(), Util.bytesToHex(rsp)));
// throw new TangemException(rspApdu.getParseErroMessage());
// } else if (rspApdu.getSW1SW2() == SW.NEED_PAUSE && mNotifications != null) {
// int remainingPause = rspApdu.getTLVs().getTagAsInt(TLV.Tag.TAG_Pause) * 10;
// Log.v("NFC", String.format(">> Security delay, remaining %f s", remainingPause / 1000.0));
// if (breakOnNeedPause) {
// break;
// } else {
// mNotifications.onReadWait(remainingPause);
// }
// } else {
// Log.v("NFC", String.format(">> [%s]: %s", cmdApdu.getCommandName(), Util.bytesToHex(rsp)));
// }
// } while (rspApdu.getSW1SW2() == SW.NEED_PAUSE);
// } finally {
// mNotifications.onReadWait(0);
// }
//
// return rspApdu;
// }
private ResponseApdu SendAndReceive(CommandApdu cmdApdu, boolean breakOnNeedPause) throws Exception {
if (mCard.encryptionMode != TangemCard.EncryptionMode.None) {
if (sessionKey == null) {