LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
MifarePlusSL3Auth.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <logicalaccess/plugins/cards/mifareplus/lla_cards_mifareplus_api.hpp>
6
7namespace logicalaccess
8{
9
14class LLA_CARDS_MIFAREPLUS_API MifarePlusSL3Auth
15{
16 public:
17 explicit MifarePlusSL3Auth(std::shared_ptr<ReaderCardAdapter> rca);
18
19 bool firstAuthenticate(int sector, std::shared_ptr<AES128Key> key,
20 MifareKeyType type);
21
25 ByteVector deriveKEnc();
26
30 ByteVector deriveKMac();
31
32 ByteVector computeWriteMac(uint8_t command_code, uint16_t block_number,
33 const ByteVector &data);
34
35 ByteVector cipherWriteData(const ByteVector &in);
36
37 private:
38 bool aes_first_auth_step2();
39
40 bool aes_first_auth_final(const ByteVector &encrypted_data);
41
42 std::shared_ptr<ReaderCardAdapter> rca_;
43
44 // The AES key used for authentication
46
47 // Random generated by us.
49
50 // Random generated by reader.
52
53 public:
55
57 uint16_t read_counter_;
58};
59}
AES128 key.
Definition: MifarePlusSL3Auth.hpp:15
ByteVector rnd_a_
Definition: MifarePlusSL3Auth.hpp:48
uint16_t read_counter_
Definition: MifarePlusSL3Auth.hpp:57
uint16_t write_counter_
Definition: MifarePlusSL3Auth.hpp:56
std::shared_ptr< ReaderCardAdapter > rca_
Definition: MifarePlusSL3Auth.hpp:42
ByteVector aes_key_
Definition: MifarePlusSL3Auth.hpp:45
ByteVector rnd_b_
Definition: MifarePlusSL3Auth.hpp:51
ByteVector trans_id_
Definition: MifarePlusSL3Auth.hpp:54
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
MifareAccessInfo.
Definition: asn1.hpp:9
MifareKeyType
Mifare Key Type.
Definition: mifareaccessinfo.hpp:18