mirror of
https://github.com/status-im/keycard-go.git
synced 2025-02-22 16:48:12 +00:00
add delete command
This commit is contained in:
parent
02fb9f848c
commit
c55b6e1593
@ -14,6 +14,7 @@ const (
|
|||||||
InsInitializeUpdate = uint8(0x50)
|
InsInitializeUpdate = uint8(0x50)
|
||||||
InsExternalAuthenticate = uint8(0x82)
|
InsExternalAuthenticate = uint8(0x82)
|
||||||
InsGetResponse = uint8(0xC0)
|
InsGetResponse = uint8(0xC0)
|
||||||
|
InsDelete = uint8(0xE4)
|
||||||
|
|
||||||
Sw1ResponseDataIncomplete = uint8(0x61)
|
Sw1ResponseDataIncomplete = uint8(0x61)
|
||||||
)
|
)
|
||||||
@ -71,6 +72,16 @@ func NewCommandGetResponse(length uint8) *apdu.Command {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewCommandDelete(aid []byte) *apdu.Command {
|
||||||
|
return apdu.NewCommand(
|
||||||
|
ClaGp,
|
||||||
|
InsDelete,
|
||||||
|
uint8(0x00),
|
||||||
|
uint8(0x00),
|
||||||
|
aid,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
func calculateHostCryptogram(encKey, cardChallenge, hostChallenge []byte) ([]byte, error) {
|
func calculateHostCryptogram(encKey, cardChallenge, hostChallenge []byte) ([]byte, error) {
|
||||||
var data []byte
|
var data []byte
|
||||||
data = append(data, cardChallenge...)
|
data = append(data, cardChallenge...)
|
||||||
|
@ -53,3 +53,13 @@ func TestNewCommandExternalAuthenticate(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, expected, hexutils.BytesToHexWithSpaces(raw))
|
assert.Equal(t, expected, hexutils.BytesToHexWithSpaces(raw))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewCommandDelete(t *testing.T) {
|
||||||
|
aid := hexutils.HexToBytes("0102030405")
|
||||||
|
cmd := NewCommandDelete(aid)
|
||||||
|
assert.Equal(t, uint8(0x80), cmd.Cla)
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user