diff --git a/globalplatform/commands.go b/globalplatform/commands.go index ff563d2..4154d8f 100644 --- a/globalplatform/commands.go +++ b/globalplatform/commands.go @@ -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, ) } diff --git a/globalplatform/commands_test.go b/globalplatform/commands_test.go index 772c6d8..97803f6 100644 --- a/globalplatform/commands_test.go +++ b/globalplatform/commands_test.go @@ -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)) }