LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
osdpsecurechannel.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_OSDPSECURECHANNEL_HPP
8#define LOGICALACCESS_OSDPSECURECHANNEL_HPP
9
13#include <logicalaccess/plugins/readers/osdp/lla_readers_osdp_api.hpp>
14
15namespace logicalaccess
16{
18{
19 NOSCS = 0x00,
20 SCS_11 = 0x11,
21 SCS_12 = 0x12,
22 SCS_13 = 0x13,
23 SCS_14 = 0x14,
24 SCS_15 = 0x15,
25 SCS_16 = 0x16,
26 SCS_17 = 0x17,
27 SCS_18 = 0x18
28};
29
33class LLA_READERS_OSDP_API OSDPSecureChannel
34{
35 public:
36 OSDPSecureChannel(ByteVector uid, ByteVector PDChallenge, ByteVector PDCryptogram,
37 ByteVector CPChallenge)
38 : isSCBK_D(false)
39 , m_uid(uid)
40 , m_PDChallenge(PDChallenge)
41 , m_PDCryptogram(PDCryptogram)
42 , m_CPChallenge(CPChallenge)
43 {
44 }
45
47 : isSCBK_D(false)
48 {
49 }
50
52 {
53 }
54
55
56 void deriveKey(std::shared_ptr<AES128Key> scbkkey,
57 std::shared_ptr<AES128Key> scbkdkey);
58
59 void computeAuthenticationData();
60
61 void verifyMAC(ByteVector data);
62
64
65 ByteVector computePacketMAC(ByteVector data);
66
67 ByteVector encryptData(ByteVector data, ByteVector iv) const;
68
69 ByteVector decryptData(ByteVector data, ByteVector iv) const;
70
72
74 {
75 return m_uid;
76 }
77
79 {
80 return m_PDChallenge;
81 }
82
84 {
85 return m_PDCryptogram;
86 }
87
89 {
90 return m_CPChallenge;
91 }
92
94 {
95 return m_CPCryptogram;
96 }
97
99 {
100 return m_smac1;
101 }
102
104 {
105 m_smac1 = smac1;
106 }
107
109 {
110 return m_smac2;
111 }
112
114 {
115 m_smac2 = smac2;
116 }
117
119 {
120 return m_senc;
121 }
122
124 {
125 m_senc = senc;
126 }
127
129 {
130 return m_rmac;
131 }
132
134 {
135 m_rmac = rmac;
136 }
137
139 {
140 return m_cmac;
141 }
142
144 {
145 m_cmac = cmac;
146 }
147
148 private:
154
160};
161}
162
163#endif /* LOGICALACCESS_OSDPSECURECHANNEL_HPP */
AES128 key.
AES initialization vector class.
OSDP Secure Channel class.
Definition: osdpsecurechannel.hpp:34
void setRMAC(ByteVector rmac)
Definition: osdpsecurechannel.hpp:133
bool isSCBK_D
Definition: osdpsecurechannel.hpp:71
ByteVector m_cmac
Definition: osdpsecurechannel.hpp:159
ByteVector m_CPCryptogram
Definition: osdpsecurechannel.hpp:153
ByteVector & getSMAC1()
Definition: osdpsecurechannel.hpp:98
~OSDPSecureChannel()
Definition: osdpsecurechannel.hpp:51
ByteVector m_PDCryptogram
Definition: osdpsecurechannel.hpp:151
ByteVector & getSMAC2()
Definition: osdpsecurechannel.hpp:108
ByteVector m_CPChallenge
Definition: osdpsecurechannel.hpp:152
ByteVector & getCPChallenge()
Definition: osdpsecurechannel.hpp:88
ByteVector & getUID()
Definition: osdpsecurechannel.hpp:73
void setSMAC1(ByteVector smac1)
Definition: osdpsecurechannel.hpp:103
ByteVector m_rmac
Definition: osdpsecurechannel.hpp:158
ByteVector & getCMAC()
Definition: osdpsecurechannel.hpp:138
ByteVector & getPDCryptogram()
Definition: osdpsecurechannel.hpp:83
void setCMAC(ByteVector cmac)
Definition: osdpsecurechannel.hpp:143
ByteVector m_smac1
Definition: osdpsecurechannel.hpp:155
ByteVector m_uid
Definition: osdpsecurechannel.hpp:149
void setSENC(ByteVector senc)
Definition: osdpsecurechannel.hpp:123
void setSMAC2(ByteVector smac2)
Definition: osdpsecurechannel.hpp:113
ByteVector & getPDChallenge()
Definition: osdpsecurechannel.hpp:78
OSDPSecureChannel(ByteVector uid, ByteVector PDChallenge, ByteVector PDCryptogram, ByteVector CPChallenge)
Definition: osdpsecurechannel.hpp:36
ByteVector & getRMAC()
Definition: osdpsecurechannel.hpp:128
OSDPSecureChannel()
Definition: osdpsecurechannel.hpp:46
ByteVector m_smac2
Definition: osdpsecurechannel.hpp:156
ByteVector m_senc
Definition: osdpsecurechannel.hpp:157
ByteVector & getCPCryptogram()
Definition: osdpsecurechannel.hpp:93
ByteVector m_PDChallenge
Definition: osdpsecurechannel.hpp:150
ByteVector & getSENC()
Definition: osdpsecurechannel.hpp:118
An AES initialization vector.
Definition: aes_initialization_vector.hpp:28
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
OSDPSecureChannelType
Definition: osdpsecurechannel.hpp:18
@ SCS_14
Definition: osdpsecurechannel.hpp:23
@ SCS_15
Definition: osdpsecurechannel.hpp:24
@ NOSCS
Definition: osdpsecurechannel.hpp:19
@ SCS_13
Definition: osdpsecurechannel.hpp:22
@ SCS_18
Definition: osdpsecurechannel.hpp:27
@ SCS_16
Definition: osdpsecurechannel.hpp:25
@ SCS_11
Definition: osdpsecurechannel.hpp:20
@ SCS_12
Definition: osdpsecurechannel.hpp:21
@ SCS_17
Definition: osdpsecurechannel.hpp:26
Reader unit.