1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/pkg/edhoc_c/edhoc_keys.h

175 lines
5.3 KiB
C

/*
* Copyright (C) 2021 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Certificates and keys for the edhoc example. This values
* are taken from the IETF lake WG test vectors, specifically
* test vector 34900, see:
* https://github.com/lake-wg/edhoc/blob/5ef58e6ee998f4b9aca4b53b35e87375ca356f32/test-vectors-05/vectors.txt
*
* @author Timothy Claeys <timothy.claeys@inria.fr>
* @author Francisco Molina <francois-xavier.molina@inria.fr>
*
* @}
*/
#ifndef EDHOC_KEYS_H
#define EDHOC_KEYS_H
#include <inttypes.h>
#include "kernel_defines.h"
#ifdef __cplusplus
extern "C" {
#endif
/* initiator CBOR-encoded authentication key */
static const uint8_t init_cbor_auth_key[] = {
0xa4, 0x01, 0x01, 0x20, 0x06, 0x21, 0x58, 0x20,
0x2c, 0x44, 0x0c, 0xc1, 0x21, 0xf8, 0xd7, 0xf2,
0x4c, 0x3b, 0x0e, 0x41, 0xae, 0xda, 0xfe, 0x9c,
0xaa, 0x4f, 0x4e, 0x7a, 0xbb, 0x83, 0x5e, 0xc3,
0x0f, 0x1d, 0xe8, 0x8a, 0xdb, 0x96, 0xff, 0x71,
0x23, 0x58, 0x20, 0x2b, 0xbe, 0xa6, 0x55, 0xc2,
0x33, 0x71, 0xc3, 0x29, 0xcf, 0xbd, 0x3b, 0x1f,
0x02, 0xc6, 0xc0, 0x62, 0x03, 0x38, 0x37, 0xb8,
0xb5, 0x90, 0x99, 0xa4, 0x43, 0x6f, 0x66, 0x60,
0x81, 0xb0, 0x8e
};
/* initiator CBOR-encoded ephemeral key */
static const uint8_t init_cbor_eph_key[] = {
0xa4, 0x01, 0x01, 0x20, 0x04, 0x21, 0x58, 0x20,
0x8d, 0x3e, 0xf5, 0x6d, 0x1b, 0x75, 0x0a, 0x43,
0x51, 0xd6, 0x8a, 0xc2, 0x50, 0xa0, 0xe8, 0x83,
0x79, 0x0e, 0xfc, 0x80, 0xa5, 0x38, 0xa4, 0x44,
0xee, 0x9e, 0x2b, 0x57, 0xe2, 0x44, 0x1a, 0x7c,
0x23, 0x58, 0x20, 0xae, 0x11, 0xa0, 0xdb, 0x86,
0x3c, 0x02, 0x27, 0xe5, 0x39, 0x92, 0xfe, 0xb8,
0xf5, 0x92, 0x4c, 0x50, 0xd0, 0xa7, 0xba, 0x6e,
0xea, 0xb4, 0xad, 0x1f, 0xf2, 0x45, 0x72, 0xf4,
0xf5, 0x7c, 0xfa
};
/* initiator CBOR-encoded RPK */
static const uint8_t init_cbor_rpk[] = {
0xa4, 0x01, 0x01, 0x20, 0x04, 0x21, 0x58, 0x20,
0x2c, 0x44, 0x0c, 0xc1, 0x21, 0xf8, 0xd7, 0xf2,
0x4c, 0x3b, 0x0e, 0x41, 0xae, 0xda, 0xfe, 0x9c,
0xaa, 0x4f, 0x4e, 0x7a, 0xbb, 0x83, 0x5e, 0xc3,
0x0f, 0x1d, 0xe8, 0x8a, 0xdb, 0x96, 0xff, 0x71,
0x6c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74,
0x20, 0x6e, 0x61, 0x6d, 0x65, 0x60
};
/* initiator CBOR-encoded rpk identifier */
static const uint8_t init_cbor_rpk_id[] = {
0xa1, 0x04, 0x41, 0x23
};
/* initiator CBOR-encoded rpk identifier */
static const uint8_t init_cbor_rpk_id_value[] = {
0x23
};
/* initiator session identifier preset */
static const uint8_t init_cid[] = {
0x16
};
/* responder CBOR-encoded authentication key */
static const uint8_t resp_cbor_auth_key[] = {
0xa4, 0x01, 0x01, 0x20, 0x06, 0x21, 0x58, 0x20,
0xa3, 0xff, 0x26, 0x35, 0x95, 0xbe, 0xb3, 0x77,
0xd1, 0xa0, 0xce, 0x1d, 0x04, 0xda, 0xd2, 0xd4,
0x09, 0x66, 0xac, 0x6b, 0xcb, 0x62, 0x20, 0x51,
0xb8, 0x46, 0x59, 0x18, 0x4d, 0x5d, 0x9a, 0x32,
0x23, 0x58, 0x20, 0xbb, 0x50, 0x1a, 0xac, 0x67,
0xb9, 0xa9, 0x5f, 0x97, 0xe0, 0xed, 0xed, 0x6b,
0x82, 0xa6, 0x62, 0x93, 0x4f, 0xbb, 0xfc, 0x7a,
0xd1, 0xb7, 0x4c, 0x1f, 0xca, 0xd6, 0x6a, 0x07,
0x94, 0x22, 0xd0
};
/* responder CBOR-encoded ephemeral key */
static const uint8_t resp_cbor_eph_key[] = {
0xa4, 0x01, 0x01, 0x20, 0x04, 0x21, 0x58, 0x20,
0x52, 0xfb, 0xa0, 0xbd, 0xc8, 0xd9, 0x53, 0xdd,
0x86, 0xce, 0x1a, 0xb2, 0xfd, 0x7c, 0x05, 0xa4,
0x65, 0x8c, 0x7c, 0x30, 0xaf, 0xdb, 0xfc, 0x33,
0x01, 0x04, 0x70, 0x69, 0x45, 0x1b, 0xaf, 0x35,
0x23, 0x58, 0x20, 0xc6, 0x46, 0xcd, 0xdc, 0x58,
0x12, 0x6e, 0x18, 0x10, 0x5f, 0x01, 0xce, 0x35,
0x05, 0x6e, 0x5e, 0xbc, 0x35, 0xf4, 0xd4, 0xcc,
0x51, 0x07, 0x49, 0xa3, 0xa5, 0xe0, 0x69, 0xc1,
0x16, 0x16, 0x9a
};
/* responder CBOR-encoded RPK */
static const uint8_t resp_cbor_rpk[] = {
0xa4, 0x01, 0x01, 0x20, 0x04, 0x21, 0x58, 0x20,
0xa3, 0xff, 0x26, 0x35, 0x95, 0xbe, 0xb3, 0x77,
0xd1, 0xa0, 0xce, 0x1d, 0x04, 0xda, 0xd2, 0xd4,
0x09, 0x66, 0xac, 0x6b, 0xcb, 0x62, 0x20, 0x51,
0xb8, 0x46, 0x59, 0x18, 0x4d, 0x5d, 0x9a, 0x32,
0x6c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74,
0x20, 0x6e, 0x61, 0x6d, 0x65, 0x60
};
/* responder CBOR-encoded rpk identifier */
static const uint8_t resp_cbor_rpk_id[] = {
0xa1, 0x04, 0x41, 0x05
};
/* responder CBOR-encoded rpk identifier */
static const uint8_t resp_cbor_rpk_id_value[] = {
0x05
};
/* responder session identifier preset */
static const uint8_t resp_cid[] = {
0x00
};
/**
* @brief Credential database entry
*/
typedef struct {
const uint8_t *id; /**< credential id pointer */
size_t id_len; /**< credential id length */
const uint8_t *cred; /**< credential pointer */
size_t cred_len; /**< credential length */
} cred_db_entry_t;
/* credential database */
static const cred_db_entry_t cred_db[] = {
{
resp_cbor_rpk_id_value,
sizeof(resp_cbor_rpk_id_value),
resp_cbor_rpk,
sizeof(resp_cbor_rpk)
},
{
init_cbor_rpk_id_value,
sizeof(init_cbor_rpk_id_value),
init_cbor_rpk,
sizeof(init_cbor_rpk)
},
};
#ifdef __cplusplus
}
#endif
#endif /* EDHOC_KEYS_H */