Contiki-NG
coap-keystore.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017, RISE SICS
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote
14 * products derived from this software without specific prior
15 * written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 *
30 */
31
32/**
33 * \file
34 * API for CoAP keystore
35 * \author
36 * Niclas Finne <nfi@sics.se>
37 * Joakim Eriksson <joakime@sics.se>
38 */
39
40/**
41 * \addtogroup coap
42 * @{
43 *
44 * \defgroup coap-keystore CoAP keystore API
45 * @{
46 *
47 * The CoAP keystore API defines a common interface for retrieving
48 * authorization information for CoAP/DTLS.
49 */
50
51#ifndef COAP_KEYSTORE_H_
52#define COAP_KEYSTORE_H_
53
54#include "coap-endpoint.h"
55
56/**
57 * The structure of a CoAP pre-shared key info.
58 */
59typedef struct {
60 const uint8_t *identity_hint;
61 uint16_t identity_hint_len;
62 const uint8_t *identity;
63 uint16_t identity_len;
64 const uint8_t *key;
65 uint16_t key_len;
67
68/**
69 * The structure of a CoAP keystore.
70 *
71 * The keystore implementation provides a function callback for each type of
72 * authorization supported. The API currently only specifies a function
73 * callback for pre-shared keys.
74 */
75typedef struct {
76 int (* coap_get_psk_info)(const coap_endpoint_t *address_info,
79
80/**
81 * \brief Set the CoAP keystore to use by CoAP.
82 * \param keystore A pointer to a CoAP keystore.
83 */
84void coap_set_keystore(const coap_keystore_t *keystore);
85
86#endif /* COAP_KEYSTORE_H_ */
87/** @} */
88/** @} */
API to address CoAP endpoints.
void coap_set_keystore(const coap_keystore_t *keystore)
Set the CoAP keystore to use by CoAP.
The structure of a CoAP pre-shared key info.
Definition: coap-keystore.h:59
The structure of a CoAP keystore.
Definition: coap-keystore.h:75