Updated on 2026-08-14
This commit is contained in:
parent
3661133163
commit
1bec351fc0
4 changed files with 17 additions and 11 deletions
|
|
@ -1,9 +1,7 @@
|
|||
package com.tangem.common.apdu
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import com.tangem.common.extensions.calculateSha256
|
||||
import com.tangem.common.extensions.toHexString
|
||||
import com.tangem.common.tlv.Tlv
|
||||
import com.tangem.SessionEnvironment
|
||||
import com.tangem.common.tlv.TlvBuilder
|
||||
import com.tangem.common.tlv.TlvTag
|
||||
import org.junit.Test
|
||||
|
|
@ -13,9 +11,9 @@ class CommandApduTest {
|
|||
|
||||
@Test
|
||||
fun `simple READ command to bytes`() {
|
||||
val pin = "000000"
|
||||
val sessionEnvironment = SessionEnvironment()
|
||||
val tlvBuilder = TlvBuilder()
|
||||
tlvBuilder.append(TlvTag.Pin, pin)
|
||||
tlvBuilder.append(TlvTag.Pin, sessionEnvironment.pin1)
|
||||
val commandApdu = CommandApdu(
|
||||
Instruction.Read,
|
||||
tlvBuilder.serialize()
|
||||
|
|
@ -30,13 +28,13 @@ class CommandApduTest {
|
|||
|
||||
@Test
|
||||
fun `READ with terminal key to bytes`() {
|
||||
val pin = "000000"
|
||||
val sessionEnvironment = SessionEnvironment()
|
||||
val terminalPublicKey = byteArrayOf(4, 80, -122, 58, -42, 74, -121, -82, -118, 47, -24, 60,
|
||||
26, -15, -88, 64, 60, -75, 63, 83, -28, -122, -40, 81, 29, -83, -118, 4, -120, 126,
|
||||
91, 35, 82, 44, -44, 112, 36, 52, 83, -94, -103, -6, -98, 119, 35, 119, 22, 16, 58,
|
||||
-68, 17, -95, -33, 56, -123, 94, -42, -14, -18, 24, 126, -100, 88, 43, -90)
|
||||
val tlvBuilder = TlvBuilder()
|
||||
tlvBuilder.append(TlvTag.Pin, pin)
|
||||
tlvBuilder.append(TlvTag.Pin, sessionEnvironment.pin1)
|
||||
tlvBuilder.append(TlvTag.TerminalPublicKey, terminalPublicKey)
|
||||
val commandApdu = CommandApdu(
|
||||
Instruction.Read,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue