7#ifndef LOGICALACCESS_MIFAREPLUSSL1COMMANDS_HPP
8#define LOGICALACCESS_MIFAREPLUSSL1COMMANDS_HPP
12#include <logicalaccess/plugins/cards/mifareplus/lla_cards_mifareplus_api.hpp>
16#define CMD_MIFAREPLUSSL1 "MifarePlusSL1"
50 virtual bool AESAuthenticate(std::shared_ptr<AES128Key> key, uint16_t keyslot);
52 virtual bool AESAuthenticateSL1(std::shared_ptr<AES128Key> key);
58 virtual bool switchLevel2(std::shared_ptr<AES128Key> key);
63 virtual bool switchLevel3(std::shared_ptr<AES128Key> key);
66 ByteVector readBinary(
unsigned char blockno,
size_t len)
override;
68 void updateBinary(
unsigned char blockno,
const ByteVector &buf)
override;
71 std::shared_ptr<MifareKey> key,
bool vol)
override;
73 void loadKey(std::shared_ptr<Location> location,
MifareKeyType keytype,
74 std::shared_ptr<MifareKey> key)
override;
76 void authenticate(
unsigned char blockno,
unsigned char keyno,
79 void authenticate(
unsigned char blockno, std::shared_ptr<KeyStorage> key_storage,
82 void increment(uint8_t blockno, uint32_t value)
override;
84 void decrement(uint8_t blockno, uint32_t value)
override;
96template <
typename MifareSL1Impl,
typename MifareClassicImpl>
116 return sl1_impl_.AESAuthenticateSL1(key);
139 std::shared_ptr<MifareKey> key,
bool vol)
override
146 std::shared_ptr<MifareKey> key)
override
152 void authenticate(
unsigned char blockno, std::shared_ptr<KeyStorage> key_storage,
156 classic_impl.authenticate(blockno, key_storage, keytype);
159 void increment(uint8_t blockno, uint32_t value)
override
165 void decrement(uint8_t blockno, uint32_t value)
override
std::shared_ptr< ReaderCardAdapter > getReaderCardAdapter() const override
Get the reader/card adapter.
Definition: commands.hpp:52
std::shared_ptr< Chip > getChip() const override
Get the chip.
Definition: commands.hpp:34
The Mifare commands class.
Definition: mifarecommands.hpp:24
Definition: mifareplussl1commands.hpp:29
MifarePlusSL1Commands()
Definition: mifareplussl1commands.hpp:31
MifarePlusSL1Commands(std::string ct)
Definition: mifareplussl1commands.hpp:36
Definition: mifareplussl1commands.hpp:98
void authenticate(unsigned char blockno, unsigned char keyno, MifareKeyType keytype) override
Authenticate a block, given a key number.
Definition: mifareplussl1commands.hpp:119
void increment(uint8_t blockno, uint32_t value) override
Definition: mifareplussl1commands.hpp:159
void loadKey(std::shared_ptr< Location > location, MifareKeyType keytype, std::shared_ptr< MifareKey > key) override
Load a key on a given location.
Definition: mifareplussl1commands.hpp:145
MifareSL1Impl sl1_impl_
Definition: mifareplussl1commands.hpp:171
bool loadKey(unsigned char keyno, MifareKeyType keytype, std::shared_ptr< MifareKey > key, bool vol) override
Load a key to the reader.
Definition: mifareplussl1commands.hpp:138
void decrement(uint8_t blockno, uint32_t value) override
Definition: mifareplussl1commands.hpp:165
void updateBinary(unsigned char blockno, const ByteVector &buf) override
Write bytes to the card.
Definition: mifareplussl1commands.hpp:132
void authenticate(unsigned char blockno, std::shared_ptr< KeyStorage > key_storage, MifareKeyType keytype) override
Authenticate a block, given a key number.
Definition: mifareplussl1commands.hpp:152
MifarePlusSL1Policy()
Definition: mifareplussl1commands.hpp:100
void fixup()
Definition: mifareplussl1commands.hpp:104
MifareClassicImpl classic_impl
Definition: mifareplussl1commands.hpp:172
ByteVector readBinary(unsigned char blockno, size_t len) override
Read bytes from the card.
Definition: mifareplussl1commands.hpp:126
bool AESAuthenticateSL1(std::shared_ptr< AES128Key > key) override
Definition: mifareplussl1commands.hpp:113
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
#define CMD_MIFAREPLUSSL1
Definition: mifareplussl1commands.hpp:16
MifareKeyType
Mifare Key Type.
Definition: mifareaccessinfo.hpp:18