acr128s

package
v0.0.0-...-89eb2bc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SLOT_SAM  = 2
	SLOT_ICC  = 1
	SLOT_PICC = 0
)

Variables

View Source
var FRAME_NACK = []byte{0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}

Functions

func BuildFrame

func BuildFrame(header BuildHeader, apdu []byte) ([]byte, error)

func BuildHeader__PC_to_RDR_Escape

func BuildHeader__PC_to_RDR_Escape(seq int, slot Slot, ledApdu int) func() []byte

func BuildHeader__PC_to_RDR_IccEspecial

func BuildHeader__PC_to_RDR_IccEspecial(seq int, slot Slot, lenApdu int) func() []byte

func BuildHeader__PC_to_RDR_IccPowerOff

func BuildHeader__PC_to_RDR_IccPowerOff(seq int, slot Slot) func() []byte

func BuildHeader__PC_to_RDR_IccPowerOn

func BuildHeader__PC_to_RDR_IccPowerOn(seq int, slot Slot) func() []byte

func BuildHeader__PC_to_RDR_XfrBlock

func BuildHeader__PC_to_RDR_XfrBlock(seq int, slot Slot, ledApdu int) func() []byte

func Checksum

func Checksum(data []byte) byte

func GetResponse__RDR_to_PC_DataBlock

func GetResponse__RDR_to_PC_DataBlock(frame []byte) ([]byte, error)

func GetResponse__RDR_to_PC_Escape

func GetResponse__RDR_to_PC_Escape(frame []byte) ([]byte, error)

func GetResponse__RDR_to_PC_SlotStatus

func GetResponse__RDR_to_PC_SlotStatus(frame []byte) ([]byte, error)

func VerifyStatusReponse

func VerifyStatusReponse(statusFrame []byte) error

Types

type BuildHeader

type BuildHeader func() []byte

type Card

type Card struct {
	// contains filtered or unexported fields
}

func (*Card) ATR

func (c *Card) ATR() ([]byte, error)

func (*Card) ATS

func (c *Card) ATS() ([]byte, error)

func (*Card) Apdu

func (c *Card) Apdu(apdu []byte) ([]byte, error)

func (*Card) DisconnectCard

func (c *Card) DisconnectCard() error

func (*Card) DisconnectResetCard

func (c *Card) DisconnectResetCard() error

func (*Card) EndTransactionResetCard

func (c *Card) EndTransactionResetCard() error

func (*Card) GetData

func (c *Card) GetData(data byte) ([]byte, error)

func (*Card) SAK

func (c *Card) SAK() byte

func (*Card) UID

func (c *Card) UID() ([]byte, error)

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device struct

func NewDevice

func NewDevice(portName string, baudRate int, timeout time.Duration) (*Device, error)

NewDevice create new serial device

func (*Device) Close

func (dev *Device) Close() bool

Close close serial device

func (*Device) Recv

func (dev *Device) Recv(timeout time.Duration) ([]byte, error)

Recv read data bytes in serial device

func (*Device) Send

func (dev *Device) Send(data []byte) (int, error)

Send write data bytes in serial device

func (*Device) SendRecv

func (dev *Device) SendRecv(data []byte, timeout time.Duration) ([]byte, error)

SendRecv write daa bytes in serial device and wait by response

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(dev *Device, readerName string, slot Slot) *Reader

NewReader Create New Reader interface

func (*Reader) ConnectCard

func (r *Reader) ConnectCard() (smartcard.ICard, error)

ConnectCard Create New Card interface with T=1

func (*Reader) ConnectMifareClassic

func (r *Reader) ConnectMifareClassic() (mifare.Classic, error)

func (*Reader) ConnectSamCard

func (r *Reader) ConnectSamCard() (smartcard.ICard, error)

ConnectSamCard Create New contact Card interface with T=1

func (*Reader) ConnectSamCard_T0

func (r *Reader) ConnectSamCard_T0() (smartcard.ICard, error)

ConnectSamCard_T0 ConnectCard connect card with protocol T=1.

func (*Reader) ConnectSamCard_Tany

func (r *Reader) ConnectSamCard_Tany() (smartcard.ICard, error)

ConnectSamCard_Tany ConnectCard connect card with protocol T=any.

func (*Reader) EscapeCommand

func (r *Reader) EscapeCommand(apdu []byte) ([]byte, error)

EscapeCommand Primitive function to send Control commands

func (*Reader) IccEspecial

func (r *Reader) IccEspecial() ([]byte, error)

Especial

func (*Reader) IccPowerOff

func (r *Reader) IccPowerOff() ([]byte, error)

IccPowerOff Power off contact card

func (*Reader) IccPowerOn

func (r *Reader) IccPowerOn() ([]byte, error)

IccPowerOn Power on contact card

func (*Reader) Transmit

func (r *Reader) Transmit(apdu []byte) ([]byte, error)

Transmit Primitive function transceive to send apdu

type Slot

type Slot int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL