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

#include <MifarePlusSL0Commands.hpp>

Inheritance diagram for logicalaccess::MifarePlusSL0Commands:
logicalaccess::Commands logicalaccess::ICommands

Public Member Functions

 MifarePlusSL0Commands ()
 
 MifarePlusSL0Commands (std::string ct)
 
virtual ~MifarePlusSL0Commands ()
 
int detectSecurityLevel () const
 
bool probeLevel3 () const
 
bool isLevel0 () const
 
bool writePerso (uint8_t hex_addr_1, uint8_t hex_addr_2, const std::array< uint8_t, 16 > &data) const
 
bool writePerso (const MifarePlusBlockKeyLocation &location, const std::array< uint8_t, 16 > &data) const
 
bool commitPerso () const
 
bool is4K () const
 
- Public Member Functions inherited from logicalaccess::Commands
 Commands ()=delete
 Constructor.
 
virtual ~Commands ()
 
std::shared_ptr< ChipgetChip () const override
 Get the chip.
 
virtual void setChip (std::shared_ptr< Chip > chip)
 Set the chip.
 
std::shared_ptr< ReaderCardAdaptergetReaderCardAdapter () const override
 Get the reader/card adapter.
 
virtual void setReaderCardAdapter (std::shared_ptr< ReaderCardAdapter > adapter)
 Set the reader/card adapter.
 
virtual const std::string & getCmdType () const
 Get the cmd name.
 
virtual void setCmdType (const std::string &command_type)
 Set the cmd name.
 
- Public Member Functions inherited from logicalaccess::ICommands
virtual ~ICommands ()=default
 
virtual std::shared_ptr< ChipgetChip () const =0
 Get the chip.
 
virtual std::shared_ptr< ReaderCardAdaptergetReaderCardAdapter () const =0
 Get the reader/card adapter.
 

Static Protected Member Functions

static bool is_trailing_block (uint8_t hex_addr1, uint8_t hex_addr2)
 
static bool validate_access_bytes (const std::array< uint8_t, 16 > &data)
 

Additional Inherited Members

- Protected Member Functions inherited from logicalaccess::Commands
 Commands (std::string commandtype)
 Constructor.
 
- Protected Attributes inherited from logicalaccess::Commands
std::shared_ptr< ReaderCardAdapterd_readerCardAdapter
 The reader/card adapter.
 
std::weak_ptr< Chipd_chip
 The chip.
 
std::string d_commandtype
 The command type.
 

Detailed Description

This implements commands that can be use to personalize the card when it is in security level 0.

Constructor & Destructor Documentation

◆ MifarePlusSL0Commands() [1/2]

logicalaccess::MifarePlusSL0Commands::MifarePlusSL0Commands ( )
inline

◆ MifarePlusSL0Commands() [2/2]

logicalaccess::MifarePlusSL0Commands::MifarePlusSL0Commands ( std::string  ct)
inlineexplicit

◆ ~MifarePlusSL0Commands()

virtual logicalaccess::MifarePlusSL0Commands::~MifarePlusSL0Commands ( )
inlinevirtual

Member Function Documentation

◆ commitPerso()

bool MifarePlusSL0Commands::commitPerso ( ) const

Send the COMMIT PERSO command, upgrading the card to level 1 or level 3 if it succeed.

◆ detectSecurityLevel()

int MifarePlusSL0Commands::detectSecurityLevel ( ) const

◆ is4K()

bool MifarePlusSL0Commands::is4K ( ) const

Attempt to deduce if the card is 4K or not.

◆ is_trailing_block()

bool MifarePlusSL0Commands::is_trailing_block ( uint8_t  hex_addr1,
uint8_t  hex_addr2 
)
staticprotected

Check whether or not this block is a sector trailer block.

◆ isLevel0()

bool MifarePlusSL0Commands::isLevel0 ( ) const

Attempt to WRITE PERSO on the card to check if it is a level 0 card.

Warning
This is a "destructive operation" because if it succeed it will rewrite a block on the card, potentially disrupting the user configuration.

◆ probeLevel3()

bool MifarePlusSL0Commands::probeLevel3 ( ) const

Probe the card, attempting to detect if it potentially is a level 3 card.

Send the "first authentication" command and check if it succeed. If the card is SL3 it should succeed (even though we won't continue the authentication) otherwise it will fail.

◆ validate_access_bytes()

bool MifarePlusSL0Commands::validate_access_bytes ( const std::array< uint8_t, 16 > &  data)
staticprotected

Verify that the access bits are valid. This is a partial verification and does not (yet ?) guarantee that the access conditions are fully safe.

◆ writePerso() [1/2]

bool MifarePlusSL0Commands::writePerso ( const MifarePlusBlockKeyLocation location,
const std::array< uint8_t, 16 > &  data 
) const

WRITE PERSO using an enum to chose the location.

◆ writePerso() [2/2]

bool MifarePlusSL0Commands::writePerso ( uint8_t  hex_addr_1,
uint8_t  hex_addr_2,
const std::array< uint8_t, 16 > &  data 
) const

Issue the WRITE PERSO command, targeting location at hex_addr_1 hex_addr_2


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