KNX IoT
KNX IoT Point API stack implementation
oc_cred.h
Go to the documentation of this file.
1 /*
2 // Copyright (c) 2016-2020 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
20 #ifndef OC_CRED_COMMON_H
21 #define OC_CRED_COMMON_H
22 
23 #include "oc_ri.h"
24 #include "oc_uuid.h"
25 #include "util/oc_list.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
35 typedef enum oc_sec_credtype_t {
38  OC_CREDTYPE_CERT = 8,
39  OC_CREDTYPE_OSCORE = 64,
40  OC_CREDTYPE_OSCORE_MCAST_CLIENT = 128,
41  OC_CREDTYPE_OSCORE_MCAST_SERVER = 256
43 
48 typedef enum oc_sec_credusage_t {
54  1 << 4,
55  OC_CREDUSAGE_MFG_CERT = 1 << 5
57 
62 typedef enum oc_sec_encoding_t {
70 
75 typedef struct oc_cred_data_t
76 {
77  oc_string_t data;
80 
85 typedef struct oc_sec_cred_t
86 {
87  struct oc_sec_cred_t *next;
88  struct
89  {
90  oc_string_t role;
91  oc_string_t authority;
92  } role;
94 #ifdef OC_PKI
97  struct oc_sec_cred_t *chain;
98  struct oc_sec_cred_t *child;
99  void *ctx;
100 #endif /* OC_PKI */
101 #ifdef OC_OSCORE
102  void *oscore_ctx;
103 #endif /* OC_OSCORE */
104  int credid;
106  oc_uuid_t subjectuuid;
107  bool owner_cred;
109 
114 typedef struct oc_sec_creds_t
115 {
116  OC_LIST_STRUCT(creds);
117  oc_uuid_t rowneruuid;
119 
127 
135 
142 oc_sec_credusage_t oc_cred_parse_credusage(oc_string_t *credusage_string);
143 
150 oc_sec_encoding_t oc_cred_parse_encoding(oc_string_t *encoding_string);
151 
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif /* OC_CRED_COMMON_H */
struct oc_cred_data_t oc_cred_data_t
credential data info
oc_sec_credtype_t
credential type information
Definition: oc_cred.h:35
@ OC_CREDTYPE_NULL
no credential
Definition: oc_cred.h:36
@ OC_CREDTYPE_PSK
PSK (personal)
Definition: oc_cred.h:37
oc_sec_encoding_t
Security encoding information.
Definition: oc_cred.h:62
@ OC_ENCODING_PEM
oic.sec.encoding.pem
Definition: oc_cred.h:66
@ OC_ENCODING_UNSUPPORTED
not supported
Definition: oc_cred.h:63
@ OC_ENCODING_BASE64
oic.sec.encoding.base64
Definition: oc_cred.h:64
@ OC_ENCODING_RAW
oic.sec.encoding.raw
Definition: oc_cred.h:65
@ OC_ENCODING_HANDLE
oic.sec.encoding.handle – Data is contained in a storage sub-system referenced using a handle
Definition: oc_cred.h:67
oc_sec_credusage_t oc_cred_parse_credusage(oc_string_t *credusage_string)
parse credential string to type
oc_sec_encoding_t oc_cred_parse_encoding(oc_string_t *encoding_string)
parse credential encoding string to type
struct oc_sec_cred_t oc_sec_cred_t
security credential information
const char * oc_cred_read_credusage(oc_sec_credusage_t credusage)
read credential usage
struct oc_sec_creds_t oc_sec_creds_t
credential and rowner information
const char * oc_cred_read_encoding(oc_sec_encoding_t encoding)
read credential encoding
oc_sec_credusage_t
credential usage
Definition: oc_cred.h:48
@ OC_CREDUSAGE_TRUSTCA
trust anchor oic.sec.cred.trustca
Definition: oc_cred.h:50
@ OC_CREDUSAGE_MFG_TRUSTCA
Manufacturer Trust CA oic.sec.cred.mfgtrustca.
Definition: oc_cred.h:53
@ OC_CREDUSAGE_NULL
no usage
Definition: oc_cred.h:49
@ OC_CREDUSAGE_IDENTITY_CERT
Certificate oic.sec.cred.cert.
Definition: oc_cred.h:51
@ OC_CREDUSAGE_MFG_CERT
Manufacturer CA oic.sec.cred.mfgcert.
Definition: oc_cred.h:55
@ OC_CREDUSAGE_ROLE_CERT
Role Certificate oic.sec.cred.rolecert.
Definition: oc_cred.h:52
const char * oc_cred_credtype_string(oc_sec_credtype_t credtype)
credential type to string
resource internals
uuid implementationGenerate and work with UUIDs as specified in RFC 4122.
credential data info
Definition: oc_cred.h:76
oc_string_t data
the credential data
Definition: oc_cred.h:77
oc_sec_encoding_t encoding
the encoding of the credential data
Definition: oc_cred.h:78
security credential information
Definition: oc_cred.h:86
oc_string_t authority
authority
Definition: oc_cred.h:91
void * ctx
security context
Definition: oc_cred.h:99
oc_string_t role
role
Definition: oc_cred.h:90
oc_cred_data_t privatedata
private data
Definition: oc_cred.h:93
struct oc_sec_cred_t * chain
chain of credentials
Definition: oc_cred.h:97
bool owner_cred
owner
Definition: oc_cred.h:107
oc_cred_data_t publicdata
public data
Definition: oc_cred.h:95
int credid
credential id
Definition: oc_cred.h:104
struct oc_sec_cred_t * next
pointer to the next credential
Definition: oc_cred.h:87
oc_uuid_t subjectuuid
subject uuid
Definition: oc_cred.h:106
oc_sec_credtype_t credtype
credential type
Definition: oc_cred.h:105
oc_sec_credusage_t credusage
credential usage
Definition: oc_cred.h:96
struct oc_sec_cred_t * child
credential child
Definition: oc_cred.h:98
credential and rowner information
Definition: oc_cred.h:115
OC_LIST_STRUCT(creds)
list of credentials
oc_uuid_t rowneruuid
row owner uuid
Definition: oc_cred.h:117