Documentation ¶
Index ¶
Constants ¶
const (
// SwOK is returned from smartcards as a positive response code.
SwOK = 0x9000
)
Variables ¶
var ( ErrUnsupportedLenth80 = errors.New("length cannot be 0x80") ErrLengthTooBig = errors.New("length cannot be more than 3 bytes") )
var ErrBadRawCommand = errors.New("command must be at least 4 bytes")
ErrBadRawCommand is an error returned by ParseCommand in case the command data is not long enough.
var ErrBadRawResponse = errors.New("response data must be at least 2 bytes")
ErrBadRawResponse is an error returned by ParseResponse in case the response data is not long enough.
Functions ¶
Types ¶
type Command ¶
type Command struct { Cla uint8 Ins uint8 P1 uint8 P2 uint8 Data []byte // contains filtered or unexported fields }
Command struct represent the data sent as an APDU command with CLA, Ins, P1, P2, Lc, Data, and Le.
func NewCommand ¶
NewCommand returns a new apdu Command.
func ParseCommand ¶
ParseCommand parses a raw command and returns a Command
type ErrBadResponse ¶
type ErrBadResponse struct { Sw uint16 // contains filtered or unexported fields }
ErrBadResponse defines an error conaining the returned Sw code and a description message.
func NewErrBadResponse ¶
func NewErrBadResponse(sw uint16, message string) *ErrBadResponse
NewErrBadResponse returns a ErrBadResponse with the specified sw and message values.
func (*ErrBadResponse) Error ¶
func (e *ErrBadResponse) Error() string
Error implements the error interface.
type ErrTagNotFound ¶
type ErrTagNotFound struct {
// contains filtered or unexported fields
}
ErrTagNotFound is an error returned if a tag is not found in a TLV sequence.
func (*ErrTagNotFound) Error ¶
func (e *ErrTagNotFound) Error() string
Error implements the error interface
type Response ¶
Response represents a struct containing the smartcard response fields.
func ParseResponse ¶
ParseResponse parses a raw response and return a Response.