mifare

package
v0.0.0-...-c4ef593 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package mifare in scardkit provides specialized functionalities for interacting with MIFARE card technologies. This includes support for various MIFARE product types such as Classic, DESFire, and Ultralight. The package encompasses operations like authentication, reading and writing to sectors and blocks, and handling MIFARE-specific security features. It is tailored for applications that require integration with MIFARE card systems, commonly used in access control, transportation, and payment systems.

Index

Constants

View Source
const (
	// Constants defining sector sizes, key types, etc.
	DefaultSectorSize = 16
	KeyTypeA          = "A"
	KeyTypeB          = "B"
)

Variables

This section is empty.

Functions

func CalculateChecksum

func CalculateChecksum(data []byte) byte

CalculateChecksum calculates a checksum for data integrity verification.

Types

type Card

type Card struct {
}

Card represents a MIFARE card with its specific attributes.

func NewCard

func NewCard(uid []byte) *Card

NewCard initializes a new MIFARE card representation.

func (*Card) AuthenticateSector

func (c *Card) AuthenticateSector(sectorNumber int, keyType string, key []byte) (bool, error)

AuthenticateSector performs authentication for a specific sector on the card.

func (*Card) ReadSector

func (c *Card) ReadSector(sectorNumber int, keyType string, key []byte) (*Sector, error)

ReadSector reads a specific sector from the card.

func (*Card) WriteSector

func (c *Card) WriteSector(sectorNumber int, data []byte, keyType string, key []byte) error

WriteSector writes data to a specific sector on the card.

type Sector

type Sector struct {
}

Sector represents a sector in a MIFARE card.

func (*Sector) Marshal

func (s *Sector) Marshal() ([]byte, error)

MarshalSector serializes a Sector into a byte slice.

func (*Sector) Unmarshal

func (s *Sector) Unmarshal(data []byte) error

UnmarshalSector sets the Sector fields from a byte slice.

Jump to

Keyboard shortcuts

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