felica

package
v0.0.0-...-13f3c6a Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressS_PAD0    byte = 0x00
	AddressS_PAD1    byte = 0x01
	AddressS_PAD2    byte = 0x02
	AddressS_PAD3    byte = 0x03
	AddressS_PAD4    byte = 0x04
	AddressS_PAD5    byte = 0x05
	AddressS_PAD6    byte = 0x06
	AddressS_PAD7    byte = 0x07
	AddressS_PAD8    byte = 0x08
	AddressS_PAD9    byte = 0x09
	AddressS_PAD10   byte = 0x0a
	AddressS_PAD11   byte = 0x0b
	AddressS_PAD12   byte = 0x0c
	AddressS_PAD13   byte = 0x0d
	AddressREG       byte = 0x0e
	AddressRC        byte = 0x80
	AddressMAC       byte = 0x81
	AddressID        byte = 0x82
	AddressD_ID      byte = 0x83
	AddressSER_C     byte = 0x84
	AddressSYS_C     byte = 0x85
	AddressCKV       byte = 0x86
	AddressCK        byte = 0x87
	AddressMC        byte = 0x88
	AddressWCNT      byte = 0x90
	AddressMAC_A     byte = 0x91
	AddressSTATE     byte = 0x92
	AddressCRC_CHECK byte = 0xa0
)
View Source
const (
	ServiceRW = 0x0009
	ServiceRO = 0x000b
)

Variables

View Source
var ErrMacNotMatched = errors.New("mac_a didn't matched")
View Source
var ErrMasterKeyNil = errors.New("master key is nil")
View Source
var ErrNoResponse = errors.New("no response from card")
View Source
var ErrUnknown = errors.New("unknown error")

Functions

This section is empty.

Types

type Block

type Block struct {
	Address byte
	Data    [16]byte
}

type DataType

type DataType byte
const (
	DataTypeUID          DataType = 0x00
	DataTypeID           DataType = 0xF0
	DataTypeCardName     DataType = 0xF1
	DataTypeCardType     DataType = 0xF3
	DataTypeCardTypeName DataType = 0xF4
)

type FeliCaLiteS

type FeliCaLiteS struct {
	CK [16]byte
	SK [16]byte
	RC [16]byte
	ID [16]byte
}

func (*FeliCaLiteS) GenCardKey

func (c *FeliCaLiteS) GenCardKey(masterKey *[24]byte)

Generate CK with ID

func (*FeliCaLiteS) GenMac

func (c *FeliCaLiteS) GenMac(data [][8]byte) [8]byte

Generate MAC with SK and RC

func (*FeliCaLiteS) GenReadMac

func (c *FeliCaLiteS) GenReadMac(blocks []Block) [8]byte

Generate MAC from readed data with SK and RC

func (*FeliCaLiteS) GenSessionKey

func (c *FeliCaLiteS) GenSessionKey()

Generate SK with CK and RC

func (*FeliCaLiteS) GenWriteMac

func (c *FeliCaLiteS) GenWriteMac(wcnt [3]byte, block Block) [8]byte

Generate MAC for write data with SK and RC

Jump to

Keyboard shortcuts

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