Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Public Member Functions | Protected Member Functions | List of all members
direct_bt::SMPPairRandMsg Class Referencefinal

Vol 3, Part H: 3.5.4 Pairing Random message. More...

#include <SMPTypes.hpp>

Inheritance diagram for direct_bt::SMPPairRandMsg:
Collaboration diagram for direct_bt::SMPPairRandMsg:

Public Member Functions

 SMPPairRandMsg (const jau::uint128dp_t &random_value)
 
 SMPPairRandMsg (const uint8_t *source, const jau::nsize_t length)
 
constexpr_cxx20 jau::nsize_t getDataSize () const noexcept override
 Returns the required data size according to the specified packet, which should be within 0-22 or 64 octets. More...
 
std::string getName () const noexcept override
 
constexpr jau::uint128dp_t getRand () const noexcept
 Returns the 128-bit Random value (16 octets) More...
 
- Public Member Functions inherited from direct_bt::SMPEncKeyByteStream
 SMPEncKeyByteStream (const Opcode opc, const jau::nsize_t size)
 Persistent memory, w/ ownership . More...
 
 SMPEncKeyByteStream (const uint8_t *source, const jau::nsize_t size)
 Persistent memory, w/ ownership . More...
 
 ~SMPEncKeyByteStream () noexcept override=default
 
- Public Member Functions inherited from direct_bt::SMPPDUMsg
 SMPPDUMsg (const Opcode opc, const jau::nsize_t size)
 Persistent memory, w/ ownership . More...
 
 SMPPDUMsg (const uint8_t *source, const jau::nsize_t size)
 Persistent memory, w/ ownership . More...
 
 SMPPDUMsg (const uint8_t *source, const jau::nsize_t size, const jau::nsize_t min_size)
 Persistent memory, w/ ownership . More...
 
virtual ~SMPPDUMsg () noexcept=default
 
constexpr jau::nsize_t getDataOffset () const noexcept
 Returns the octet offset to the data segment in this PDU including the mandatory opcode, i.e. More...
 
virtual constexpr_cxx20 jau::nsize_t getDataSize () const noexcept
 Returns the required data size according to the specified packet, which should be within 0-22 or 64 octets. More...
 
virtual std::string getName () const noexcept
 
constexpr Opcode getOpcode () const noexcept
 SMP Command Codes Vol 3, Part H (SM): 3.3. More...
 
constexpr jau::nsize_t getPDUParamSize () const noexcept
 Returns the actual PDU size less one octet for the opcode, which should result in 0-22 octets or 64 octets. More...
 
constexpr uint64_t getTimestamp () const noexcept
 
virtual std::string toString () const noexcept
 

Protected Member Functions

std::string valueString () const noexcept override
 
- Protected Member Functions inherited from direct_bt::SMPPDUMsg
virtual std::string baseString () const noexcept
 
void check_range ()
 
void checkOpcode (const Opcode exp1, const Opcode exp2) const
 
void checkOpcode (const Opcode expected) const
 
virtual std::string valueString () const noexcept
 

Additional Inherited Members

- Public Types inherited from direct_bt::SMPPDUMsg
enum class  Opcode : uint8_t {
  UNDEFINED = 0x00 , PAIRING_REQUEST = 0x01 , PAIRING_RESPONSE = 0x02 , PAIRING_CONFIRM = 0x03 ,
  PAIRING_RANDOM = 0x04 , PAIRING_FAILED = 0x05 , ENCRYPTION_INFORMATION = 0x06 , MASTER_IDENTIFICATION = 0x07 ,
  IDENTITY_INFORMATION = 0x08 , IDENTITY_ADDRESS_INFORMATION = 0x09 , SIGNING_INFORMATION = 0x0A , SECURITY_REQUEST = 0x0B ,
  PAIRING_PUBLIC_KEY = 0x0C , PAIRING_DHKEY_CHECK = 0x0D , PAIRING_KEYPRESS_NOTIFICATION = 0x0E
}
 SMP Command Codes Vol 3, Part H (SM): 3.3. More...
 
- Static Public Member Functions inherited from direct_bt::SMPPDUMsg
template<class T >
static T * clone (const T &source) noexcept
 Clone template for convenience, based on derived class's copy-constructor. More...
 
static std::string getOpcodeString (const Opcode opc) noexcept
 
static std::unique_ptr< const SMPPDUMsggetSpecialized (const uint8_t *buffer, jau::nsize_t const buffer_size) noexcept
 Return a newly created specialized instance pointer to base class. More...
 
static constexpr uint8_t number (const Opcode rhs) noexcept
 
- Protected Attributes inherited from direct_bt::SMPPDUMsg
jau::POctets pdu
 actual received PDU More...
 
uint64_t ts_creation
 creation timestamp in milliseconds More...
 

Detailed Description

Vol 3, Part H: 3.5.4 Pairing Random message.

Vol 3 (Host), Part H (SM): 3 (SMP), 3.5 Pairing Methods

Opcode::PAIRING_RANDOM

[uint8_t opcode]
jau::uint128_t random_value

Used by the initiating and responding device to send the random number used to calculate the Confirm value sent in the Pairing Confirm command.

The initiating device sends a Pairing Random command after it has received a Pairing Confirm command from the responding device.

LE legacy pairing: Responding device sends a Pairing Random command after receiving a Pairing Random command from the initiating device if the Confirm value calculated on the responding device matches the Confirm value received from the initiating device.
If the calculated Confirm value does not match then the responding device shall respond with the Pairing Failed command.

LE Secure Connections: Responding device sends a Pairing Random command after it has received a Pairing Random command from the initiating device if the Confirm value calculated on the responding device matches the Confirm value received from the initiating device(?).
If the calculated Confirm value does not match then the responding device shall respond with the Pairing Failed command.

The initiating device shall encrypt the link using the generated key (STK in LE legacy pairing or LTK in LE Secure Connections) if the Confirm value calculated on the initiating device matches the Confirm value received from the responding device.
The successful encryption or re-encryption of the link is the signal to the responding device that key generation has completed successfully.
If the calculated Confirm value does not match then the initiating device shall respond with the Pairing Failed command.

Notable: No endian wise conversion shall occur on this data, since the encryption values are interpreted as little-endian or as a byte stream.

Definition at line 1343 of file SMPTypes.hpp.

Constructor & Destructor Documentation

◆ SMPPairRandMsg() [1/2]

direct_bt::SMPPairRandMsg::SMPPairRandMsg ( const uint8_t *  source,
const jau::nsize_t  length 
)
inline

Definition at line 1346 of file SMPTypes.hpp.

◆ SMPPairRandMsg() [2/2]

direct_bt::SMPPairRandMsg::SMPPairRandMsg ( const jau::uint128dp_t random_value)
inline

Definition at line 1353 of file SMPTypes.hpp.

Member Function Documentation

◆ getDataSize()

constexpr_cxx20 jau::nsize_t direct_bt::SMPPairRandMsg::getDataSize ( ) const
inlineoverridevirtualnoexcept

Returns the required data size according to the specified packet, which should be within 0-22 or 64 octets.

See also
SMPPDUMsg::getPDUParamSize()

Reimplemented from direct_bt::SMPPDUMsg.

Definition at line 1360 of file SMPTypes.hpp.

◆ getRand()

constexpr jau::uint128dp_t direct_bt::SMPPairRandMsg::getRand ( ) const
inlineconstexprnoexcept

Returns the 128-bit Random value (16 octets)

In LE legacy pairing, the initiating device sends Mrand and the responding device sends Srand as defined in Vol 3, Part H, 2.3.5.5 SM - Pairing algo - LE legacy pairing phase 2

In LE Secure Connections, the initiating device sends Na and the responding device sends Nb.

Definition at line 1376 of file SMPTypes.hpp.

◆ getName()

std::string direct_bt::SMPPairRandMsg::getName ( ) const
inlineoverridevirtualnoexcept

Reimplemented from direct_bt::SMPPDUMsg.

Definition at line 1378 of file SMPTypes.hpp.

◆ valueString()

std::string direct_bt::SMPPairRandMsg::valueString ( ) const
inlineoverrideprotectedvirtualnoexcept

Reimplemented from direct_bt::SMPPDUMsg.

Definition at line 1383 of file SMPTypes.hpp.


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