diff --git a/tangem-sdk-android/src/main/java/com/tangem/sdk/nfc/NfcReader.kt b/tangem-sdk-android/src/main/java/com/tangem/sdk/nfc/NfcReader.kt index f083bac9..8a61dfa8 100644 --- a/tangem-sdk-android/src/main/java/com/tangem/sdk/nfc/NfcReader.kt +++ b/tangem-sdk-android/src/main/java/com/tangem/sdk/nfc/NfcReader.kt @@ -11,7 +11,6 @@ import com.tangem.common.apdu.ResponseApdu import com.tangem.common.core.CompletionCallback import com.tangem.common.core.TagType import com.tangem.common.core.TangemSdkError -import com.tangem.common.extensions.toHexString import com.tangem.common.nfc.CardReader import com.tangem.common.nfc.ReadingActiveListener import kotlinx.coroutines.CoroutineScope @@ -148,7 +147,6 @@ class NfcReader : CardReader { override fun transceiveRaw(apduData: ByteArray, callback: CompletionCallback) { val rawResponse: ByteArray? = try { - Log.nfc { "transceiveRaw: " + apduData.toHexString() } transcieveAndLog(apduData) } catch (exception: TagLostException) { Log.nfc { "ERROR transceiving data TagLostException: $exception" } @@ -166,13 +164,10 @@ class NfcReader : CardReader { private fun transcieveAndLog(apduData: ByteArray): ByteArray? { Log.nfc { "transcieve..." } - val startTime = System.currentTimeMillis() val isExtendedLengthApduSupported = nfcTag?.isoDep?.isExtendedLengthApduSupported Log.nfc { "isExtendedLengthApduSupported $isExtendedLengthApduSupported" } Log.nfc { "transcieveAndLog: isoDep isConnected = " + nfcTag?.isoDep?.isConnected } val rawResponse = nfcTag?.isoDep?.transceive(apduData) - val finishTime = System.currentTimeMillis() - Log.nfc { "transcieve success: [${finishTime - startTime}] ms" } return rawResponse } diff --git a/tangem-sdk-core/src/main/java/com/tangem/common/tlv/Tlv.kt b/tangem-sdk-core/src/main/java/com/tangem/common/tlv/Tlv.kt index 0c257b77..4f758db8 100644 --- a/tangem-sdk-core/src/main/java/com/tangem/common/tlv/Tlv.kt +++ b/tangem-sdk-core/src/main/java/com/tangem/common/tlv/Tlv.kt @@ -33,7 +33,12 @@ class Tlv { .replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() } val tagFullName = "TAG_$tagName" val size = String.format("%02d", value.size) - return "$tagFullName [0x$tagRaw:$size]: ${value.toHexString()}" + val tagContent = if (!tag.shouldMask) { + "[0x$tagRaw:$size]: ${value.toHexString()}" + } else { + "*****" + } + return "$tagFullName $tagContent" } companion object { diff --git a/tangem-sdk-core/src/main/java/com/tangem/common/tlv/TlvTag.kt b/tangem-sdk-core/src/main/java/com/tangem/common/tlv/TlvTag.kt index f8801355..18ddc4c0 100644 --- a/tangem-sdk-core/src/main/java/com/tangem/common/tlv/TlvTag.kt +++ b/tangem-sdk-core/src/main/java/com/tangem/common/tlv/TlvTag.kt @@ -27,7 +27,7 @@ enum class TlvValueType { /** * Contains all TLV tags, with their code and descriptive name. */ -enum class TlvTag(val code: Int) { +enum class TlvTag(val code: Int, val shouldMask: Boolean = false) { Unknown(code = 0x00), CardId(code = 0x01), Status(code = 0x02), @@ -45,10 +45,10 @@ enum class TlvTag(val code: Int) { CreateWalletAtPersonalize(code = 0x0E), Health(code = 0x0F), - Pin(code = 0x10), - Pin2(code = 0x11), - NewPin(code = 0x12), - NewPin2(code = 0x13), + Pin(code = 0x10, shouldMask = true), + Pin2(code = 0x11, shouldMask = true), + NewPin(code = 0x12, shouldMask = true), + NewPin2(code = 0x13, shouldMask = true), PublicKeyChallenge(code = 0x14), PublicKeySalt(code = 0x15), Challenge(code = 0x16), @@ -59,7 +59,7 @@ enum class TlvTag(val code: Int) { SessionKeyA(code = 0x1A), SessionKeyB(code = 0x1B), Pause(code = 0x1C), - NewPin3(code = 0x1E), + NewPin3(code = 0x1E, shouldMask = true), CrExKey(code = 0x1F), Uid(code = 0x0B), @@ -94,7 +94,7 @@ enum class TlvTag(val code: Int) { PinIsDefault(code = 0x5A), Pin2IsDefault(code = 0x59), - WalletPublicKey(code = 0x60), + WalletPublicKey(code = 0x60, shouldMask = true), WalletSignature(code = 0x61), WalletRemainingSignatures(code = 0x62), WalletSignedHashes(code = 0x63), @@ -106,7 +106,7 @@ enum class TlvTag(val code: Int) { WalletHDPath(code = 0x6A), WalletHDChain(code = 0x6B), - WalletPrivateKey(code = 0x6F), + WalletPrivateKey(code = 0x6F, shouldMask = true), Firmware(code = 0x80), BatchId(code = 0x81),