RMW desert 5.0.0
Loading...
Searching...
No Matches
sec_utils.h File Reference

Utilities for the security layer. More...

Go to the source code of this file.

Macros

#define MIN(a, b)

Functions

bool decode_hex (const std::string &hex, std::vector< uint8_t > &out)
 Decodes a hexadecimal string into a byte vector.

Detailed Description

Utilities for the security layer.

This header declares utility functions shared by the security layer. It includes helpers for converting hexadecimal strings into byte vectors and small generic macros used while processing cryptographic input data. These utilities support configuration parsing and internal data handling.

Author
Dmytro Ochkas

Macro Definition Documentation

◆ MIN

#define MIN ( a,
b )
Value:
((a) > (b) ? (b) : (a))

Function Documentation

◆ decode_hex()

bool decode_hex ( const std::string & hex,
std::vector< uint8_t > & out )

Decodes a hexadecimal string into a byte vector.

The input can optionally begin with the prefixes 0x or 0X. After an optional prefix, the string must contain an even number of valid hexadecimal characters.

Parameters
hexString containing hexadecimal byte values.
outOutput vector receiving the decoded bytes.
Returns
true if the complete input is valid and has been decoded; false if the input has an odd length or contains non-hexadecimal characters.
Note
On failure, out is cleared.