Browse Source

Strip the status code off from APDU responses

Peter Cai 3 years ago
parent
commit
b008115ed1

+ 6 - 2
libs/lpad-sm-dp-plus-connector/src/main/java/com/truphone/lpa/impl/download/ApduTransmitter.java

@@ -30,7 +30,9 @@ public class ApduTransmitter {
             LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - Transmit APDU response: " + apduResponse);
         }
 
-        return apduResponse;
+        // Last 2 bytes are the status code (should be 0x9000)
+        // TODO: Do this properly
+        return apduResponse.substring(0, apduResponse.length() - 4);
     }
 
     String transmitApdus(List<String> apdus) {
@@ -46,7 +48,9 @@ public class ApduTransmitter {
             LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - Transmit APDUs response: " + apduResponse);
         }
 
-        return apduResponse;
+        // Last 2 bytes are the status code (should be 0x9000)
+        // TODO: Do this properly
+        return apduResponse.substring(0, apduResponse.length() - 4);
     }
 
     void addApduTransmittedListener(ApduTransmittedListener apduTransmittedListener) {