LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
logicalaccess::ATRParser Class Reference

#include <atrparser.hpp>

Classes

struct  ATRInfo
 

Public Member Functions

 ATRParser (const ByteVector &atr)
 

Static Public Member Functions

static std::string guessCardType (const ByteVector &atr, PCSCReaderUnitType reader_type)
 
static std::string guessCardType (uint8_t *atr, size_t atrlen, PCSCReaderUnitType reader_type)
 
static std::string guessCardType (const std::string &atr_str, PCSCReaderUnitType reader_type)
 
static std::string guessCardType (const ByteVector &atr)
 
static std::string guessCardType (uint8_t *atr, size_t atrlen)
 
static std::string guessCardType (const std::string &atr_str)
 

Private Member Functions

std::string parse (bool ignore_reader_type, const PCSCReaderUnitType &reader_type) const
 
std::string check_hardcoded (bool ignore_reader_type, const PCSCReaderUnitType &reader_type) const
 
std::string check_from_atr () const
 
std::string check_generic_from_atr () const
 
void register_hardcoded_atr (const std::string &atr, const std::string &card_type, PCSCReaderUnitType reader_type)
 
void register_hardcoded_atr (const std::string &atr, const std::string &card_type)
 

Static Private Member Functions

static std::string atr_x_to_type (uint8_t code)
 

Private Attributes

ByteVector atr_
 
std::map< ByteVector, ATRInfohardcoded_atr_to_type_
 

Detailed Description

An helper class that helps deducing the type of card from its ATR.

Constructor & Destructor Documentation

◆ ATRParser()

logicalaccess::ATRParser::ATRParser ( const ByteVector atr)
explicit

Member Function Documentation

◆ atr_x_to_type()

std::string logicalaccess::ATRParser::atr_x_to_type ( uint8_t  code)
staticprivate

Deduce the card type from one byte of the ATR.

◆ check_from_atr()

std::string logicalaccess::ATRParser::check_from_atr ( ) const
private

◆ check_generic_from_atr()

std::string logicalaccess::ATRParser::check_generic_from_atr ( ) const
private

◆ check_hardcoded()

std::string logicalaccess::ATRParser::check_hardcoded ( bool  ignore_reader_type,
const PCSCReaderUnitType reader_type 
) const
private

◆ guessCardType() [1/6]

std::string logicalaccess::ATRParser::guessCardType ( const ByteVector atr)
static

Guess the card type from an ATR that works for any reader type.

Boilerplate to prepare the proper call to parse()

◆ guessCardType() [2/6]

std::string logicalaccess::ATRParser::guessCardType ( const ByteVector atr,
PCSCReaderUnitType  reader_type 
)
static

Guess the card type from an ATR for a specific reader.

◆ guessCardType() [3/6]

std::string logicalaccess::ATRParser::guessCardType ( const std::string &  atr_str)
static

Guess the card from an hexadecimal string representation of the ATR.

◆ guessCardType() [4/6]

std::string logicalaccess::ATRParser::guessCardType ( const std::string &  atr_str,
PCSCReaderUnitType  reader_type 
)
static

Guess the card from an hexadecimal string representation of the ATR.

◆ guessCardType() [5/6]

std::string logicalaccess::ATRParser::guessCardType ( uint8_t *  atr,
size_t  atrlen 
)
static

◆ guessCardType() [6/6]

std::string logicalaccess::ATRParser::guessCardType ( uint8_t *  atr,
size_t  atrlen,
PCSCReaderUnitType  reader_type 
)
static

◆ parse()

std::string logicalaccess::ATRParser::parse ( bool  ignore_reader_type,
const PCSCReaderUnitType reader_type 
) const
private

ATR Parsing code

◆ register_hardcoded_atr() [1/2]

void logicalaccess::ATRParser::register_hardcoded_atr ( const std::string &  atr,
const std::string &  card_type 
)
private

Register an harcoded ATR acceptable for any reader.

Hardcoded ATR related code

◆ register_hardcoded_atr() [2/2]

void logicalaccess::ATRParser::register_hardcoded_atr ( const std::string &  atr,
const std::string &  card_type,
PCSCReaderUnitType  reader_type 
)
private

Register an hardcoded ATR.

The ATR will be register for a unique type of PCSC Reader.

Member Data Documentation

◆ atr_

ByteVector logicalaccess::ATRParser::atr_
private

◆ hardcoded_atr_to_type_

std::map<ByteVector, ATRInfo> logicalaccess::ATRParser::hardcoded_atr_to_type_
private

A map mapping ATR hexadecimal representation to the type of card they represent.


The documentation for this class was generated from the following files: