Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
SMPKeyBin.hpp
Go to the documentation of this file.
1 /*
2  * Author: Sven Gothel <sgothel@jausoft.com>
3  * Copyright (c) 2021 Gothel Software e.K.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef SMPKEYBIN_HPP_
26 #define SMPKEYBIN_HPP_
27 
28 #include <cstring>
29 #include <string>
30 #include <memory>
31 #include <cstdint>
32 #include <fstream>
33 #include <iostream>
34 
35 #include "SMPTypes.hpp"
36 #include "BTDevice.hpp"
37 
38 namespace direct_bt {
39 
40 /**
41  * Storage for SMP keys including the required connection parameter.
42  *
43  * Storage for a device's BDAddressAndType, its security connection setup ::BTSecurityLevel + ::SMPIOCapability
44  * and optionally the initiator and responder SMPLongTermKeyInfo (LTK) and SMPSignatureResolvingKeyInfo (CSRK) within one file.
45  * <p>
46  * Since the SMPLongTermKeyInfo (LTK) and SMPSignatureResolvingKeyInfo (CSRK)
47  * can be optionally set due to their availability per initiator and responder,
48  * implementation supports mixed mode for certain devices.
49  * E.g. LTK responder key only etc.
50  * </p>
51  * <p>
52  * Filename as retrieved by SMPKeyBin::getFileBasename()
53  * has the following form `bd_C0_26_DA_01_DA_B1_1-smpkey.bin`:
54  * <ul>
55  * <li>{@code 'bd_'} denotes prefix</li>
56  * <li>{@code 'C0_26_DA_01_DA_B1'} denotes the {@link EUI48} address</li>
57  * <li>{@code '_1'} denotes the {@link BDAddressType}</li>
58  * <li>{@code '-smpkey.bin'} denotes the suffix</li>
59  * </li>
60  * </p>
61  */
62 class SMPKeyBin {
63  public:
64  constexpr static const uint16_t VERSION = (uint16_t)0b0101010101010101U + (uint16_t)2U; // bitpattern + version
65 
66  private:
67  uint16_t version; // 2
68  uint16_t size; // 2
69  uint64_t ts_creation_sec; // 8
70  BDAddressAndType addrAndType; // 7
71  BTSecurityLevel sec_level; // 1
72  SMPIOCapability io_cap; // 1
73 
74  SMPKeyType keys_init; // 1
75  SMPKeyType keys_resp; // 1
76 
77  SMPLongTermKeyInfo ltk_init; // 28 (optional)
78  SMPSignatureResolvingKeyInfo csrk_init; // 17 (optional)
79 
80  SMPLongTermKeyInfo ltk_resp; // 28 (optional)
81  SMPSignatureResolvingKeyInfo csrk_resp; // 17 (optional)
82 
83  // Min-Max: 23 - 113 bytes
84 
85  bool verbose;
86 
87  constexpr uint16_t calcSize() const {
88  uint16_t s = 0;
89  s += sizeof(version);
90  s += sizeof(size);
91  s += sizeof(ts_creation_sec);
92  s += sizeof(addrAndType.address);
93  s += sizeof(addrAndType.type);
94  s += sizeof(sec_level);
95  s += sizeof(io_cap);
96 
97  s += sizeof(keys_init);
98  s += sizeof(keys_resp);
99 
100  if( hasLTKInit() ) {
101  s += sizeof(ltk_init);
102  }
103  if( hasCSRKInit() ) {
104  s += sizeof(csrk_init);
105  }
106 
107  if( hasLTKResp() ) {
108  s += sizeof(ltk_resp);
109  }
110  if( hasCSRKResp() ) {
111  s += sizeof(csrk_resp);
112  }
113  return s;
114  }
115 
116  static bool remove_impl(const std::string& fname);
117 
118  public:
119  /**
120  * Create a new SMPKeyBin instance based upon given BTDevice's
121  * BTSecurityLevel, SMPPairingState, PairingMode and LTK keys.
122  *
123  * Returned SMPKeyBin shall be tested if valid via SMPKeyBin::isValid(),
124  * whether the retrieved data from BTDevice is consistent and hence
125  * having BTDevice is a well connected state.
126  *
127  * @param device the BTDevice from which all required data is derived
128  * @return a valid SMPKeyBin instance if properly connected, otherwise an invalid instance.
129  * @see BTDevice
130  * @see isValid()
131  */
132  static SMPKeyBin create(const BTDevice& device);
133 
134  /**
135  * Create a new SMPKeyBin instance on the fly based upon given BTDevice's
136  * BTSecurityLevel, SMPPairingState, PairingMode and LTK keys.
137  * If valid, instance is stored to a file denoted by `path` and `BTDevice::getAddressAndType()`.
138  *
139  * Method returns `false` if resulting SMPKeyBin is not SMPKeyBin::isValid().
140  *
141  * Otherwise, method returns the SMPKeyBin::write() result.
142  *
143  * @param device the BTDevice from which all required data is derived
144  * @param path the path for the stored SMPKeyBin file.
145  * @param overwrite if `true` and file already exists, delete file first. If `false` and file exists, return `false` w/o writing.
146  * @param verbose_ set to true to have detailed write processing logged to stderr, otherwise false
147  * @return `true` if file has been successfully written, otherwise `false`.
148  * @see BTDevice
149  * @see Create()
150  * @see write()
151  * @see isValid()
152  */
153  static bool createAndWrite(const BTDevice& device, const std::string& path, const bool overwrite, const bool verbose_);
154 
155  /**
156  * Create a new SMPKeyBin instance based upon stored file denoted by `fname`.
157  *
158  * Returned SMPKeyBin shall be tested if valid via SMPKeyBin::isValid(),
159  * whether the read() operation was successful and data is consistent.
160  *
161  * If file is invalid, it is removed.
162  *
163  * @param fname full path of the stored SMPKeyBin file.
164  * @param verbose_ set to true to have detailed read processing logged to stderr, otherwise false
165  * @return valid SMPKeyBin instance if file exist and read successfully, otherwise invalid SMPKeyBin instance.
166  * @see isValid()
167  * @see read()
168  */
169  static SMPKeyBin read(const std::string& fname, const bool verbose_) {
170  SMPKeyBin smpKeyBin;
171  smpKeyBin.setVerbose( verbose_ );
172  smpKeyBin.read( fname ); // read failure -> !isValid()
173  return smpKeyBin;
174  }
175 
176  /**
177  * Create a new SMPKeyBin instance on the fly based upon stored file denoted by `path` and BTDevice::getAddressAndType(),
178  * i.e. `path/` + getFileBasename().
179  *
180  * Method returns ::HCIStatusCode::INVALID_PARAMS if resulting SMPKeyBin is not SMPKeyBin::isValid().
181  *
182  * Otherwise, method returns the HCIStatusCode of SMPKeyBin::apply().
183  *
184  * If key file is invalid or key could not be applied, i.e. not returning ::HCIStatusCode::SUCCESS, it is removed.
185  *
186  * @param path the path of the stored SMPKeyBin file.
187  * @param device the BTDevice for which address the stored SMPKeyBin file will be read and applied to
188  * @param minSecLevel minimum BTSecurityLevel the read SMPKeyBin::sec_level must be compliant to.
189  * If SMPKeyBin::sec_level < minSecLevel method removes the key file and returns ::HCIStatusCode::ENCRYPTION_MODE_NOT_ACCEPTED.
190  * @param verbose_ set to true to have detailed read processing logged to stderr, otherwise false
191  * @return ::HCIStatusCode::SUCCESS or error code for failure
192  * @see Read()
193  * @see isValid()
194  * @see read()
195  * @see apply()
196  */
197  static HCIStatusCode readAndApply(const std::string& path, BTDevice& device, const BTSecurityLevel minSecLevel, const bool verbose_);
198 
199  SMPKeyBin(const BDAddressAndType& addrAndType_,
200  const BTSecurityLevel sec_level_, const SMPIOCapability io_cap_)
201  : version(VERSION), size(0),
202  ts_creation_sec( jau::getWallClockSeconds() ),
203  addrAndType(addrAndType_), sec_level(sec_level_), io_cap(io_cap_),
204  keys_init(SMPKeyType::NONE), keys_resp(SMPKeyType::NONE),
205  ltk_init(), csrk_init(), ltk_resp(), csrk_resp(),
206  verbose(false)
207  { size = calcSize(); }
208 
210  : version(VERSION), size(0),
211  ts_creation_sec(0),
212  addrAndType(), sec_level(BTSecurityLevel::UNSET), io_cap(SMPIOCapability::UNSET),
213  keys_init(SMPKeyType::NONE), keys_resp(SMPKeyType::NONE),
214  ltk_init(), csrk_init(), ltk_resp(), csrk_resp(),
215  verbose(false)
216  { size = calcSize(); }
217 
218  constexpr bool isVersionValid() const noexcept { return VERSION==version; }
219  constexpr uint16_t getVersion() const noexcept { return version;}
220 
221  constexpr bool isSizeValid() const noexcept { return calcSize() == size;}
222  constexpr uint16_t getSize() const noexcept { return size;}
223 
224  /** Returns the creation timestamp in seconds since Unix epoch */
225  constexpr uint64_t getCreationTime() const noexcept { return ts_creation_sec; }
226 
227  constexpr const BDAddressAndType& getAddrAndType() const noexcept { return addrAndType; }
228  constexpr BTSecurityLevel getSecLevel() const noexcept { return sec_level; }
229  constexpr SMPIOCapability getIOCap() const noexcept { return io_cap; }
230 
231  constexpr bool hasLTKInit() const noexcept { return ( SMPKeyType::ENC_KEY & keys_init ) != SMPKeyType::NONE; }
232  constexpr bool hasCSRKInit() const noexcept { return ( SMPKeyType::SIGN_KEY & keys_init ) != SMPKeyType::NONE; }
233  constexpr const SMPLongTermKeyInfo& getLTKInit() const noexcept { return ltk_init; }
234  constexpr const SMPSignatureResolvingKeyInfo& getCSRKInit() const noexcept { return csrk_init; }
235  void setLTKInit(const SMPLongTermKeyInfo& v) noexcept {
236  ltk_init = v;
237  keys_init |= SMPKeyType::ENC_KEY;
238  size = calcSize();
239  }
240  void setCSRKInit(const SMPSignatureResolvingKeyInfo& v) noexcept {
241  csrk_init = v;
242  keys_init |= SMPKeyType::SIGN_KEY;
243  size = calcSize();
244  }
245 
246  constexpr bool hasLTKResp() const noexcept { return ( SMPKeyType::ENC_KEY & keys_resp ) != SMPKeyType::NONE; }
247  constexpr bool hasCSRKResp() const noexcept { return ( SMPKeyType::SIGN_KEY & keys_resp ) != SMPKeyType::NONE; }
248  constexpr const SMPLongTermKeyInfo& getLTKResp() const noexcept { return ltk_resp; }
249  constexpr const SMPSignatureResolvingKeyInfo& getCSRKResp() const noexcept { return csrk_resp; }
250  void setLTKResp(const SMPLongTermKeyInfo& v) noexcept {
251  ltk_resp = v;
252  keys_resp |= SMPKeyType::ENC_KEY;
253  size = calcSize();
254  }
255  void setCSRKResp(const SMPSignatureResolvingKeyInfo& v) noexcept {
256  csrk_resp = v;
257  keys_resp |= SMPKeyType::SIGN_KEY;
258  size = calcSize();
259  }
260 
261  void setVerbose(bool v) noexcept { verbose = v; }
262 
263  /**
264  * Returns `true` if
265  *
266  * isVersionValid() && isSizeValid() &&
267  * not BTSecurityLevel::UNSET &&
268  * not SMPIOCapability::UNSET &&
269  * has valid LTK, if at all
270  *
271  */
272  constexpr bool isValid() const noexcept {
273  return isVersionValid() && isSizeValid() &&
274  BTSecurityLevel::UNSET != sec_level &&
275  SMPIOCapability::UNSET != io_cap &&
276  ( !hasLTKInit() || ltk_init.isValid() ) &&
277  ( !hasLTKResp() || ltk_resp.isValid() );
278  }
279 
280  std::string toString() const noexcept;
281 
282  /**
283  * Returns the base filename, see SMPKeyBin API doc for naming scheme.
284  */
285  std::string getFileBasename() const noexcept;
286 
287  /**
288  * Returns the base filename, see SMPKeyBin API doc for naming scheme.
289  */
290  static std::string getFileBasename(const BDAddressAndType& addrAndType_);
291 
292  static std::string getFilename(const std::string& path, const BDAddressAndType& addrAndType_) {
293  return path + "/" + getFileBasename(addrAndType_);
294  }
295 
296  static bool remove(const std::string& path, const BDAddressAndType& addrAndType_) {
297  return remove_impl(getFilename(path, addrAndType_));
298  }
299 
300  bool write(const std::string& fname, const bool overwrite) const noexcept;
301 
302  bool read(const std::string& fname);
303 
304  /**
305  * If this instance isValid() and initiator or responder LTK available, i.e. hasLTKInit() or hasLTKResp(),
306  * the following procedure will be applied to the given BTDevice:
307  *
308  * - If BTSecurityLevel _is_ BTSecurityLevel::NONE
309  * + Setting security to ::BTSecurityLevel::NONE and ::SMPIOCapability::NO_INPUT_NO_OUTPUT via BTDevice::setConnSecurity()
310  * - else if BTSecurityLevel > BTSecurityLevel::NONE
311  * + Setting security to ::BTSecurityLevel::ENC_ONLY and ::SMPIOCapability::NO_INPUT_NO_OUTPUT via BTDevice::setConnSecurity()
312  * + Setting initiator LTK from getLTKInit() via BTDevice::setLongTermKeyInfo(), if available
313  * + Setting responder LTK from getLTKResp() via BTDevice::setLongTermKeyInfo(), if available
314  *
315  * If all three operations succeed, ::HCIStatusCode::SUCCESS will be returned,
316  * otherwise the appropriate status code below.
317  *
318  * ::BTSecurityLevel::ENC_ONLY is set to avoid a new SMP ::PairingMode negotiation,
319  * which is undesired as this instances' stored LTK shall be used for ::PairingMode::PRE_PAIRED.
320  *
321  * Method may fail for any of the following reasons:
322  *
323  * Reason | ::HCIStatusCode |
324  * :------------------------------------------------------ | :------------------------------------------ |
325  * ! isValid() | ::HCIStatusCode::INVALID_PARAMS |
326  * ! hasLTKInit() && ! hasLTKResp() | ::HCIStatusCode::INVALID_PARAMS |
327  * BTDevice::isValid() == false | ::HCIStatusCode::INVALID_PARAMS |
328  * BTDevice has already being connected | ::HCIStatusCode::CONNECTION_ALREADY_EXISTS |
329  * BTDevice::connectLE() or BTDevice::connectBREDR() called | ::HCIStatusCode::CONNECTION_ALREADY_EXISTS |
330  * BTDevice::setLongTermKeyInfo() failed | ::HCIStatusCode from BT adapter |
331  *
332  * On failure and after BTDevice::setConnSecurity() has been performed, the ::BTSecurityLevel
333  * and ::SMPIOCapability pre-connect values have been written and must be set by the caller again.
334  *
335  * @param device the BTDevice for which this instances' LTK shall be applied
336  *
337  * @see isValid()
338  * @see hasLTKInit()
339  * @see hasLTKResp()
340  * @see getLTKInit()
341  * @see getLTKResp()
342  * @see ::BTSecurityLevel
343  * @see ::SMPIOCapability
344  * @see BTDevice::isValid()
345  * @see BTDevice::setConnSecurity()
346  * @see BTDevice::setLongTermKeyInfo()
347  */
348  HCIStatusCode apply(BTDevice & device) const noexcept;
349 };
350 
351 } // namespace direct_bt
352 
353 #endif /* SMPKEYBIN_HPP_ */
direct_bt::SMPIOCapability::UNSET
@ UNSET
Denoting unset value, i.e.
direct_bt::SMPKeyBin::apply
HCIStatusCode apply(BTDevice &device) const noexcept
If this instance isValid() and initiator or responder LTK available, i.e.
Definition: SMPKeyBin.cpp:364
direct_bt::SMPKeyBin::read
static SMPKeyBin read(const std::string &fname, const bool verbose_)
Create a new SMPKeyBin instance based upon stored file denoted by fname.
Definition: SMPKeyBin.hpp:169
direct_bt::SMPKeyBin::setCSRKResp
void setCSRKResp(const SMPSignatureResolvingKeyInfo &v) noexcept
Definition: SMPKeyBin.hpp:255
direct_bt::SMPKeyType
SMPKeyType
SMP Key Type for Distribution, indicates keys distributed in the Transport Specific Key Distribution ...
Definition: SMPTypes.hpp:385
direct_bt::SMPKeyBin::setCSRKInit
void setCSRKInit(const SMPSignatureResolvingKeyInfo &v) noexcept
Definition: SMPKeyBin.hpp:240
direct_bt::SMPKeyBin::getIOCap
constexpr SMPIOCapability getIOCap() const noexcept
Definition: SMPKeyBin.hpp:229
direct_bt::SMPKeyBin::write
bool write(const std::string &fname, const bool overwrite) const noexcept
Definition: SMPKeyBin.cpp:189
direct_bt
Definition: ATTPDUTypes.hpp:171
direct_bt::SMPKeyBin::getFilename
static std::string getFilename(const std::string &path, const BDAddressAndType &addrAndType_)
Definition: SMPKeyBin.hpp:292
jau
Definition: basic_algos.hpp:34
direct_bt::SMPKeyType::SIGN_KEY
@ SIGN_KEY
Indicates that the device shall distribute CSRK using the Signing Information command.
direct_bt::SMPKeyBin::setVerbose
void setVerbose(bool v) noexcept
Definition: SMPKeyBin.hpp:261
direct_bt::BTSecurityLevel
BTSecurityLevel
Bluetooth Security Level.
Definition: BTTypes0.hpp:211
direct_bt::SMPKeyBin::hasLTKResp
constexpr bool hasLTKResp() const noexcept
Definition: SMPKeyBin.hpp:246
direct_bt::HCIStatusCode
HCIStatusCode
BT Core Spec v5.2: Vol 1, Part F Controller Error Codes: 1.3 List of Error Codes.
Definition: HCITypes.hpp:124
direct_bt::SMPKeyBin::getFileBasename
std::string getFileBasename() const noexcept
Returns the base filename, see SMPKeyBin API doc for naming scheme.
Definition: SMPKeyBin.cpp:169
direct_bt::SMPKeyBin::hasCSRKInit
constexpr bool hasCSRKInit() const noexcept
Definition: SMPKeyBin.hpp:232
direct_bt::SMPKeyType::ENC_KEY
@ ENC_KEY
LE legacy pairing: Indicates device shall distribute LTK using the Encryption Information command,...
direct_bt::SMPKeyBin::isVersionValid
constexpr bool isVersionValid() const noexcept
Definition: SMPKeyBin.hpp:218
direct_bt::BDAddressAndType::type
BDAddressType type
Definition: BTAddress.hpp:429
direct_bt::SMPKeyBin::VERSION
constexpr static const uint16_t VERSION
Definition: SMPKeyBin.hpp:64
jau::getWallClockSeconds
uint64_t getWallClockSeconds() noexcept
Returns current wall-clock system time of day in seconds since Unix Epoch 00:00:00 UTC on 1 January 1...
Definition: basic_types.cpp:54
direct_bt::SMPKeyBin::create
static SMPKeyBin create(const BTDevice &device)
Create a new SMPKeyBin instance based upon given BTDevice's BTSecurityLevel, SMPPairingState,...
Definition: SMPKeyBin.cpp:46
direct_bt::SMPSignatureResolvingKeyInfo
SMP Signature Resolving Key Info, used for platform agnostic persistence.
Definition: SMPTypes.hpp:598
direct_bt::SMPKeyBin::getAddrAndType
constexpr const BDAddressAndType & getAddrAndType() const noexcept
Definition: SMPKeyBin.hpp:227
direct_bt::BTSecurityLevel::UNSET
@ UNSET
Security Level not set, value 0.
direct_bt::SMPKeyBin::getSecLevel
constexpr BTSecurityLevel getSecLevel() const noexcept
Definition: SMPKeyBin.hpp:228
direct_bt::SMPKeyBin
Storage for SMP keys including the required connection parameter.
Definition: SMPKeyBin.hpp:62
direct_bt::SMPKeyBin::setLTKInit
void setLTKInit(const SMPLongTermKeyInfo &v) noexcept
Definition: SMPKeyBin.hpp:235
SMPTypes.hpp
direct_bt::SMPKeyBin::toString
std::string toString() const noexcept
Definition: SMPKeyBin.cpp:120
direct_bt::SMPKeyBin::readAndApply
static HCIStatusCode readAndApply(const std::string &path, BTDevice &device, const BTSecurityLevel minSecLevel, const bool verbose_)
Create a new SMPKeyBin instance on the fly based upon stored file denoted by path and BTDevice::getAd...
Definition: SMPKeyBin.cpp:92
direct_bt::SMPKeyBin::SMPKeyBin
SMPKeyBin(const BDAddressAndType &addrAndType_, const BTSecurityLevel sec_level_, const SMPIOCapability io_cap_)
Definition: SMPKeyBin.hpp:199
direct_bt::SMPKeyBin::setLTKResp
void setLTKResp(const SMPLongTermKeyInfo &v) noexcept
Definition: SMPKeyBin.hpp:250
direct_bt::BDAddressAndType::address
EUI48 address
Definition: BTAddress.hpp:428
direct_bt::SMPIOCapability
SMPIOCapability
Vol 3, Part H, 2.3.2 IO capabilities.
Definition: SMPTypes.hpp:185
direct_bt::SMPKeyBin::hasLTKInit
constexpr bool hasLTKInit() const noexcept
Definition: SMPKeyBin.hpp:231
direct_bt::SMPKeyBin::getLTKResp
constexpr const SMPLongTermKeyInfo & getLTKResp() const noexcept
Definition: SMPKeyBin.hpp:248
direct_bt::SMPKeyBin::getCSRKResp
constexpr const SMPSignatureResolvingKeyInfo & getCSRKResp() const noexcept
Definition: SMPKeyBin.hpp:249
direct_bt::SMPKeyBin::remove
static bool remove(const std::string &path, const BDAddressAndType &addrAndType_)
Definition: SMPKeyBin.hpp:296
direct_bt::SMPKeyBin::hasCSRKResp
constexpr bool hasCSRKResp() const noexcept
Definition: SMPKeyBin.hpp:247
direct_bt::SMPKeyBin::createAndWrite
static bool createAndWrite(const BTDevice &device, const std::string &path, const bool overwrite, const bool verbose_)
Create a new SMPKeyBin instance on the fly based upon given BTDevice's BTSecurityLevel,...
Definition: SMPKeyBin.cpp:79
direct_bt::SMPKeyBin::getVersion
constexpr uint16_t getVersion() const noexcept
Definition: SMPKeyBin.hpp:219
direct_bt::SMPKeyBin::isValid
constexpr bool isValid() const noexcept
Returns true if.
Definition: SMPKeyBin.hpp:272
direct_bt::SMPKeyBin::getCSRKInit
constexpr const SMPSignatureResolvingKeyInfo & getCSRKInit() const noexcept
Definition: SMPKeyBin.hpp:234
direct_bt::SMPKeyBin::getSize
constexpr uint16_t getSize() const noexcept
Definition: SMPKeyBin.hpp:222
direct_bt::SMPKeyBin::SMPKeyBin
SMPKeyBin()
Definition: SMPKeyBin.hpp:209
direct_bt::SMPKeyBin::isSizeValid
constexpr bool isSizeValid() const noexcept
Definition: SMPKeyBin.hpp:221
direct_bt::BDAddressAndType
Unique Bluetooth EUI48 address and BDAddressType tuple.
Definition: BTAddress.hpp:417
direct_bt::SMPLongTermKeyInfo::isValid
constexpr bool isValid() const noexcept
Definition: SMPTypes.hpp:522
direct_bt::BTDevice
Definition: BTDevice.hpp:57
BTDevice.hpp
direct_bt::SMPKeyBin::getLTKInit
constexpr const SMPLongTermKeyInfo & getLTKInit() const noexcept
Definition: SMPKeyBin.hpp:233
direct_bt::SMPKeyBin::getCreationTime
constexpr uint64_t getCreationTime() const noexcept
Returns the creation timestamp in seconds since Unix epoch.
Definition: SMPKeyBin.hpp:225
direct_bt::SMPLongTermKeyInfo
SMP Long Term Key Info, used for platform agnostic persistence.
Definition: SMPTypes.hpp:522
direct_bt::SMPKeyType::NONE
@ NONE