mifare

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 8 Imported by: 16

Documentation

Overview

* Implementation to mifare smartcard family (Mifare Plus, Desfire, SamAV2, ...) /*

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessConditions

func AccessConditions(sectorTrailer *AccessBitsSectorTrailer, block2, block1, block0 *AccessBitsData, sl3 bool) []byte

func BitPosition

func BitPosition(position int, bit bool) int

func VerifyResponseIso7816

func VerifyResponseIso7816(response []byte) error

Types

type AccessBitsData

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

func NewAccessBits

func NewAccessBits() *AccessBitsData

func (*AccessBitsData) Anything

func (acl *AccessBitsData) Anything() *AccessBitsData

func (*AccessBitsData) OnlyRead_AB

func (acl *AccessBitsData) OnlyRead_AB() *AccessBitsData

func (*AccessBitsData) OnlyRead_B

func (acl *AccessBitsData) OnlyRead_B() *AccessBitsData

func (*AccessBitsData) ReadWrite_B

func (acl *AccessBitsData) ReadWrite_B() *AccessBitsData

func (*AccessBitsData) Read_AB_Value_AB

func (acl *AccessBitsData) Read_AB_Value_AB() *AccessBitsData

func (*AccessBitsData) Read_AB_Write_B

func (acl *AccessBitsData) Read_AB_Write_B() *AccessBitsData

func (*AccessBitsData) SetPlain

func (acl *AccessBitsData) SetPlain() *AccessBitsData

func (*AccessBitsData) Whole_AB

func (acl *AccessBitsData) Whole_AB() *AccessBitsData

func (*AccessBitsData) Whole_B_Read_A_Value_A

func (acl *AccessBitsData) Whole_B_Read_A_Value_A() *AccessBitsData

type AccessBitsSectorTrailer

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

func NewAccessBitsSectorTrailer

func NewAccessBitsSectorTrailer() *AccessBitsSectorTrailer

func (*AccessBitsSectorTrailer) KeyAB__ReadACL

func (acl *AccessBitsSectorTrailer) KeyAB__ReadACL() *AccessBitsSectorTrailer

func (*AccessBitsSectorTrailer) KeyAB__ReadACL2

func (acl *AccessBitsSectorTrailer) KeyAB__ReadACL2() *AccessBitsSectorTrailer

func (*AccessBitsSectorTrailer) KeyA__ReadACL_ReadB

func (acl *AccessBitsSectorTrailer) KeyA__ReadACL_ReadB() *AccessBitsSectorTrailer

func (*AccessBitsSectorTrailer) KeyA__ReadA_ReadWriteACL_ReadWriteB

func (acl *AccessBitsSectorTrailer) KeyA__ReadA_ReadWriteACL_ReadWriteB() *AccessBitsSectorTrailer

func (*AccessBitsSectorTrailer) KeyA__WriteA_ReadACL_ReadWriteB

func (acl *AccessBitsSectorTrailer) KeyA__WriteA_ReadACL_ReadWriteB() *AccessBitsSectorTrailer

func (*AccessBitsSectorTrailer) KeyB__ReadWriteACL___KeyA_readACL

func (acl *AccessBitsSectorTrailer) KeyB__ReadWriteACL___KeyA_readACL() *AccessBitsSectorTrailer

func (*AccessBitsSectorTrailer) KeyB__WriteA_ReadACL_WriteB___keyA__ReadACL

func (acl *AccessBitsSectorTrailer) KeyB__WriteA_ReadACL_WriteB___keyA__ReadACL() *AccessBitsSectorTrailer

func (*AccessBitsSectorTrailer) KeyB__WriteA_ReadWriteACL_WriteB___KeyA_readACL

func (acl *AccessBitsSectorTrailer) KeyB__WriteA_ReadWriteACL_WriteB___KeyA_readACL() *AccessBitsSectorTrailer

func (*AccessBitsSectorTrailer) SetPlain

type Classic

type Classic interface {
	smartcard.ICard
	Auth(bNr, keyType int, key []byte) ([]byte, error)
	ReadBlocks(bNr, ext int) ([]byte, error)
	WriteBlock(bNr int, data []byte) ([]byte, error)
	Inc(bNr int, data []byte) error
	Dec(bNr int, data []byte) error
	Copy(bNr, dstBnr int) error
}

Classic Mifare Plus Interface

func ConnectMclassic

func ConnectMclassic(r IReaderClassic) (Classic, error)

ConnectMclassic Create Mifare Plus Interface

type INS

type INS byte
const (
	SamAuthMFP     INS = 0xA3
	SamAuthHAv2    INS = 0xA4
	SamDumpSessKey INS = 0xD5
	SamGetVers     INS = 0x60
	MfpFirstAuthf1 INS = 0x70
	MfpFirstAuthf2 INS = 0x72
)

type IReaderClassic

type IReaderClassic interface {
	ConnectMifareClassic() (Classic, error)
}

type MifarePlus

type MifarePlus interface {
	smartcard.ICard
	WritePerso(int, []byte) ([]byte, error) //SL0
	CommitPerso() ([]byte, error)           //SL0
	FirstAuthf1(keyBNr int) ([]byte, error)
	FirstAuthf2([]byte) ([]byte, error)
	FirstAuth(keyBNr int, key []byte) ([]byte, error)
	ReadPlainMacMac(bNr, ext int) ([]byte, error)
	ReadPlainMacUnMacCommand(bNr, ext int) ([]byte, error)
	ReadEncMacMac(bNr, ext int) ([]byte, error)
	WriteEncMacMac(bNr int, data []byte) error
	IncTransfEncMacMac(bNr int, data []byte) error
	DecTransfEncMacMac(bNr int, data []byte) error
	TransfMacMac(bNr int) error
	KeyEnc(key []byte)
	KeyMac(key []byte)
	Ti(ti []byte)
	ReadCounter(counter int)
	WriteCounter(counter int)
}

MifarePlus MifarePlus Interface

func ConnectMplus

func ConnectMplus(r smartcard.IReader) (MifarePlus, error)

ConnectMplus Create Mifare Plus Interface

func Mplus

func Mplus(c smartcard.ICard) MifarePlus

Mplus Create Mifare Plus Interface

Directories

Path Synopsis
desfire
ev2
* package with common functions to manage a Desfire TAG
* package with common functions to manage a Desfire TAG

Jump to

Keyboard shortcuts

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