6#include <qcbor/qcbor.h>
9#include <t_cose/t_cose_common.h>
15 static constexpr int64_t PARAM_ALG = 1;
16 static constexpr int64_t PARAM_CONTENT_TYPE = 3;
17 static constexpr int64_t PARAM_KID = 4;
18 static constexpr int64_t PARAM_X5CHAIN = 33;
20 static constexpr auto CONTENT_TYPE_APPLICATION_JSON_VALUE =
26 static std::string qcbor_buf_to_string(
const UsefulBufC& buf)
28 return std::string(
reinterpret_cast<const char*
>(buf.ptr), buf.len);
31 static std::vector<uint8_t> qcbor_buf_to_byte_vector(
const UsefulBufC& buf)
33 auto ptr =
static_cast<const uint8_t*
>(buf.ptr);
34 return {ptr, ptr + buf.len};
37 static bool is_ecdsa_alg(int64_t cose_alg)
39 return cose_alg == T_COSE_ALGORITHM_ES256 ||
40 cose_alg == T_COSE_ALGORITHM_ES384 || cose_alg == T_COSE_ALGORITHM_ES512;
43 static bool is_rsa_alg(int64_t cose_alg)
45 return cose_alg == T_COSE_ALGORITHM_PS256 ||
46 cose_alg == T_COSE_ALGORITHM_PS384 || cose_alg == T_COSE_ALGORITHM_PS512;
57 std::runtime_error(msg)
Definition cose_auth.cpp:21
std::span< const uint8_t > Signature
Definition cose_common.h:24
Definition cose_common.h:50
COSEDecodeError(const std::string &msg)
Definition cose_common.h:51
Definition cose_common.h:55
COSESignatureValidationError(const std::string &msg)
Definition cose_common.h:56