mirror of
https://github.com/status-im/keycard-go.git
synced 2025-02-22 00:28:21 +00:00
add tlv formatting to delete data
This commit is contained in:
parent
c55b6e1593
commit
50bfda60e0
@ -17,6 +17,8 @@ const (
|
||||
InsDelete = uint8(0xE4)
|
||||
|
||||
Sw1ResponseDataIncomplete = uint8(0x61)
|
||||
|
||||
tagDeleteAID = byte(0x4F)
|
||||
)
|
||||
|
||||
func NewCommandSelect(aid []byte) *apdu.Command {
|
||||
@ -73,12 +75,15 @@ func NewCommandGetResponse(length uint8) *apdu.Command {
|
||||
}
|
||||
|
||||
func NewCommandDelete(aid []byte) *apdu.Command {
|
||||
data := []byte{tagDeleteAID, byte(len(aid))}
|
||||
data = append(data, aid...)
|
||||
|
||||
return apdu.NewCommand(
|
||||
ClaGp,
|
||||
InsDelete,
|
||||
uint8(0x00),
|
||||
uint8(0x00),
|
||||
aid,
|
||||
data,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -61,5 +61,7 @@ func TestNewCommandDelete(t *testing.T) {
|
||||
assert.Equal(t, uint8(0xE4), cmd.Ins)
|
||||
assert.Equal(t, uint8(0x00), cmd.P1)
|
||||
assert.Equal(t, uint8(0x00), cmd.P2)
|
||||
assert.Equal(t, aid, cmd.Data)
|
||||
|
||||
expected := "4F050102030405"
|
||||
assert.Equal(t, expected, hexutils.BytesToHex(cmd.Data))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user