From c295a6815f341bdd6ee8f0b6a3800f88cf91615e Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Mon, 23 Oct 2017 20:06:52 +0200 Subject: [PATCH] write nfc communication to debug output --- .../keychain/securitytoken/NfcTransport.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java index f004379bd..808b92410 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java @@ -18,7 +18,10 @@ package org.sufficientlysecure.keychain.securitytoken; import android.nfc.Tag; +import android.util.Log; +import org.bouncycastle.util.encoders.Hex; +import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity; import java.io.IOException; @@ -44,7 +47,17 @@ public class NfcTransport implements Transport { */ @Override public ResponseApdu transceive(final CommandApdu data) throws IOException { - return ResponseApdu.fromBytes(mIsoCard.transceive(data.toBytes())); + byte[] rawCommand = data.toBytes(); + if (Constants.DEBUG) { + Log.d(Constants.TAG, "nfc out: " + Hex.toHexString(rawCommand)); + } + + byte[] rawResponse = mIsoCard.transceive(rawCommand); + if (Constants.DEBUG) { + Log.d(Constants.TAG, "nfc in: " + Hex.toHexString(rawResponse)); + } + + return ResponseApdu.fromBytes(rawResponse); } /**