diff --git a/apdu/command.go b/apdu/command.go index da629ab..145bf14 100644 --- a/apdu/command.go +++ b/apdu/command.go @@ -18,7 +18,6 @@ type Command struct { Data []byte le uint8 requiresLe bool - requiresLc bool } // NewCommand returns a new apdu Command. @@ -30,7 +29,6 @@ func NewCommand(cla, ins, p1, p2 uint8, data []byte) *Command { P2: p2, Data: data, requiresLe: false, - requiresLc: false, } } @@ -40,10 +38,6 @@ func (c *Command) SetLe(le uint8) { c.le = le } -func (c *Command) RequiresLc() { - c.requiresLc = true -} - // Le returns if Le is set and its value. func (c *Command) Le() (bool, uint8) { return c.requiresLe, c.le @@ -69,7 +63,7 @@ func (c *Command) Serialize() ([]byte, error) { return nil, err } - if (len(c.Data) > 0) || c.requiresLc { + if len(c.Data) > 0 { if err := binary.Write(buf, binary.BigEndian, uint8(len(c.Data))); err != nil { return nil, err } diff --git a/commands.go b/commands.go index b252a4d..0a3fe19 100644 --- a/commands.go +++ b/commands.go @@ -340,18 +340,13 @@ func NewCommandSign(data []byte, p1 uint8, pathStr string) (*apdu.Command, error } func NewCommandGetData(typ uint8) *apdu.Command { - cmd := apdu.NewCommand( + return apdu.NewCommand( globalplatform.ClaGp, InsGetData, typ, 0, - []byte{}, + []byte{0xCA}, ) - - cmd.SetLe(0) - cmd.RequiresLc() - - return cmd } func NewCommandStoreData(typ uint8, data []byte) *apdu.Command {