| 
    libwebsockets
    
   Lightweight C library for HTML5 websockets 
   | 
 
 This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | lws_cose_key | 
| struct | lws_cose_validate_res_t | 
| struct | lws_cose_sig_ext_pay_t | 
| struct | lws_cose_validate_create_info | 
| struct | lws_cose_sign_create_info | 
Macros | |
| #define | LCSC_FL_ADD_CBOR_TAG (1 << 0) | 
| #define | LCSC_FL_ADD_CBOR_PREFER_MAC0 (1 << 1) | 
Typedefs | |
| typedef int64_t | cose_param_t | 
| typedef struct lws_cose_key | lws_cose_key_t | 
| typedef int(* | lws_cose_key_import_callback) (struct lws_cose_key *s, void *user) | 
| typedef int(* | lws_cose_sign_ext_pay_cb_t) (lws_cose_sig_ext_pay_t *x) | 
| typedef int(* | lws_cose_validate_pay_cb_t) (struct lws_cose_validate_context *cps, void *opaque, const uint8_t *paychunk, size_t paychunk_len) | 
| typedef struct lws_cose_validate_create_info | lws_cose_validate_create_info_t | 
| typedef struct lws_cose_sign_create_info | lws_cose_sign_create_info_t | 
| struct lws_cose_key | 
Definition at line 271 of file lws-cose.h.
 Collaboration diagram for lws_cose_key:| Data Fields | ||
|---|---|---|
| struct lws_gencrypto_keyelem | e[LWS_GENCRYPTO_MAX_KEYEL_COUNT] | |
| struct lws_gencrypto_keyelem | meta[LWS_COUNT_COSE_KEY_ELEMENTS] | |
| lws_dll2_t | list | |
| int | gencrypto_kty | 
 one of LWS_GENCRYPTO_KTY_  | 
| cose_param_t | kty | |
| cose_param_t | cose_alg | |
| cose_param_t | cose_curve | |
| char | private_key | |
| struct lws_cose_validate_res_t | 
Definition at line 366 of file lws-cose.h.
 Collaboration diagram for lws_cose_validate_res_t:| Data Fields | ||
|---|---|---|
| lws_dll2_t | list | |
| const lws_cose_key_t * | cose_key | |
| cose_param_t | cose_alg | |
| int | result | |
| struct lws_cose_sig_ext_pay_t | 
Definition at line 382 of file lws-cose.h.
 Collaboration diagram for lws_cose_sig_ext_pay_t:| Data Fields | ||
|---|---|---|
| struct lws_cose_validate_context * | cps | |
| const uint8_t * | ext | |
| size_t | xl | |
| struct lws_cose_validate_create_info | 
Definition at line 393 of file lws-cose.h.
 Collaboration diagram for lws_cose_validate_create_info:| Data Fields | ||
|---|---|---|
| struct lws_context * | cx | 
 REQUIRED: the lws context  | 
| lws_dll2_owner_t * | keyset | 
 REQUIRED: one or more cose_keys  | 
| enum lws_cose_sig_types | sigtype | 
 0 if a CBOR tag is in the sig, else one of SIGTYPE_MULTI, SIGTYPE_SINGLE, etc  | 
| lws_cose_validate_pay_cb_t | pay_cb | 
 optional: called back with unvalidated payload pieces  | 
| void * | pay_opaque | 
 optional: passed into pay_cb callback along with payload chunk  | 
| lws_cose_sign_ext_pay_cb_t | ext_cb | 
 optional extra application data provision callback  | 
| void * | ext_opaque | 
 optional extra application data provision callback opaque  | 
| size_t | ext_len | 
 if we have extra app data, this must be set to the length of it  | 
| struct lws_cose_sign_create_info | 
Definition at line 456 of file lws-cose.h.
 Collaboration diagram for lws_cose_sign_create_info:| Data Fields | ||
|---|---|---|
| struct lws_context * | cx | 
 REQUIRED: the lws context  | 
| lws_dll2_owner_t * | keyset | 
 REQUIRED: one or more cose_keys  | 
| lws_lec_pctx_t * | lec | 
 REQUIRED: the cbor output context to emit to, user must initialize with lws_lec_init() beforehand  | 
| lws_cose_sign_ext_pay_cb_t | ext_cb | 
 optional extra application data provision callback  | 
| void * | ext_opaque | 
 optional extra application data provision callback opaque  | 
| size_t | ext_len | 
 if we have extra app data, this must be set to the length of it  | 
| size_t | inline_payload_len | 
 REQUIRED: size of the inline payload we will provide  | 
| int | flags | 
 bitmap of LCSC_FL_*  | 
| enum lws_cose_sig_types | sigtype | 
 0, or sign type hint  | 
| #define LCSC_FL_ADD_CBOR_TAG (1 << 0) | 
Definition at line 453 of file lws-cose.h.
| #define LCSC_FL_ADD_CBOR_PREFER_MAC0 (1 << 1) | 
Definition at line 454 of file lws-cose.h.
| typedef int64_t cose_param_t | 
Definition at line 259 of file lws-cose.h.
| typedef struct lws_cose_key lws_cose_key_t | 
| typedef int(* lws_cose_key_import_callback) (struct lws_cose_key *s, void *user) | 
Definition at line 284 of file lws-cose.h.
| typedef int(* lws_cose_sign_ext_pay_cb_t) (lws_cose_sig_ext_pay_t *x) | 
Definition at line 388 of file lws-cose.h.
| typedef int(* lws_cose_validate_pay_cb_t) (struct lws_cose_validate_context *cps, void *opaque, const uint8_t *paychunk, size_t paychunk_len) | 
Definition at line 389 of file lws-cose.h.
| typedef struct lws_cose_validate_create_info lws_cose_validate_create_info_t | 
| typedef struct lws_cose_sign_create_info lws_cose_sign_create_info_t | 
| anonymous enum | 
Definition at line 33 of file lws-cose.h.
| Enumerator | |
|---|---|
| COSEKEY_META_KTY | |
| COSEKEY_META_KID | |
| COSEKEY_META_KEY_OPS | |
| COSEKEY_META_BASE_IV | |
| COSEKEY_META_ALG | |
| LWS_COUNT_COSE_KEY_ELEMENTS | |
Definition at line 249 of file lws-cose.h.
| enum lws_cose_sig_types | 
| Enumerator | |
|---|---|
| SIGTYPE_UNKNOWN | |
| SIGTYPE_MULTI | |
| SIGTYPE_SINGLE | |
| SIGTYPE_COUNTERSIGNED | |
| SIGTYPE_MAC | |
| SIGTYPE_MAC0 | |
Definition at line 355 of file lws-cose.h.
| anonymous enum | 
| Enumerator | |
|---|---|
| LCOSESIGEXTCB_RET_FINISHED | |
| LCOSESIGEXTCB_RET_AGAIN | |
| LCOSESIGEXTCB_RET_ERROR | |
Definition at line 376 of file lws-cose.h.
| LWS_VISIBLE LWS_EXTERN const char * lws_cose_alg_to_name | ( | cose_param_t | alg | ) | 
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN cose_param_t lws_cose_name_to_alg | ( | const char * | name | ) | 
| LWS_VISIBLE LWS_EXTERN lws_cose_key_t * lws_cose_key_import | ( | lws_dll2_owner_t * | pkey_set, | 
| lws_cose_key_import_callback | cb, | ||
| void * | user, | ||
| const uint8_t * | in, | ||
| size_t | len ) | 
lws_cose_jwk_import() - Create an lws_cose_key_t object from cose_key CBOR
| pkey_set | NULL, or a pointer to an lws_dll2_owner_t for a cose_key set | 
| cb | callback for each jwk-processed key, or NULL if importing a single key with no parent "keys" JSON | 
| user | pointer to be passed to the callback, otherwise ignored by lws. NULL if importing a single key with no parent "keys" JSON | 
| in | a single cose_key | 
| len | the length of the cose_key in bytes | 
Creates a single lws_cose_key_t if pkey_set is NULL or if the incoming CBOR doesn't start with an array, otherwise expects a CBOR array containing zero or more cose_key CBOR, and adds each to the pkey_set lws_dll2_owner_t struct. Created lws_cose_key_t are filled with data from the COSE representation and can be used with other COSE crypto ops. 
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN enum lws_lec_pctx_ret lws_cose_key_export | ( | lws_cose_key_t * | ck, | 
| lws_lec_pctx_t * | ctx, | ||
| int | flags ) | 
lws_cose_key_export() - Create cose_key CBOR from an lws_cose_key_t
| ck | the lws_cose_key_t to export to CBOR | 
| ctx | the CBOR writing context (same as for lws_lec_printf()) | 
| flags | 0 to export only public elements, or LWSJWKF_EXPORT_PRIVATE | 
Creates an lws_jwk struct filled with data from the COSE representation.
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN lws_cose_key_t * lws_cose_key_generate | ( | struct lws_context * | context, | 
| cose_param_t | cose_kty, | ||
| int | use_mask, | ||
| int | bits, | ||
| const char * | curve, | ||
| const uint8_t * | kid, | ||
| size_t | kl ) | 
lws_cose_key_generate() - generate a fresh key
| context | the lws_context used to get random | 
| cose_kty | one of LWSCOSE_WKKTV_ indicating the well-known key type | 
| use_mask | 0, or a bitfield where (1 << LWSCOSE_WKKO_...) set means valid for use | 
| bits | key bits for RSA | 
| curve | for EC keys, one of "P-256", "P-384" or "P-521" currently | 
| kid | string describing the key, or NULL | 
Create an lws_cose_key_t of the specified type and return it
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN lws_cose_key_t * lws_cose_key_from_set | ( | lws_dll2_owner_t * | set, | 
| const uint8_t * | kid, | ||
| size_t | kl ) | 
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN void lws_cose_key_destroy | ( | lws_cose_key_t ** | ck | ) | 
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN void lws_cose_key_set_destroy | ( | lws_dll2_owner_t * | o | ) | 
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN void lws_cose_key_dump | ( | const lws_cose_key_t * | ck | ) | 
| LWS_VISIBLE LWS_EXTERN struct lws_cose_validate_context * lws_cose_validate_create | ( | const lws_cose_validate_create_info_t * | info | ) | 
lws_cose_validate_create() - create a signature validation context
| info | struct describing the validation context to create | 
Creates a signature validation context set up as described in info.
You can then pass the signature cbor chunks to it using lws_cose_validate_chunk(), finialize and get the results list using lws_cose_validate_results() and destroy with lws_cose_validate_destroy().
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN int lws_cose_validate_chunk | ( | struct lws_cose_validate_context * | cps, | 
| const uint8_t * | in, | ||
| size_t | in_len, | ||
| size_t * | used_in ) | 
lws_cose_validate_chunk() - passes chunks of CBOR into the signature validator
| cps | the validation context | 
| in | the chunk of CBOR (does not have to be logically complete) | 
| in_len | number of bytes available at in  | 
Parses signature CBOR to produce a list of result objects.
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN lws_dll2_owner_t * lws_cose_validate_results | ( | struct lws_cose_validate_context * | cps | ) | 
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN void lws_cose_validate_destroy | ( | struct lws_cose_validate_context ** | cps | ) | 
| LWS_VISIBLE LWS_EXTERN struct lws_cose_sign_context * lws_cose_sign_create | ( | const lws_cose_sign_create_info_t * | info | ) | 
lws_cose_sign_create() - Create a signing context
| info | a structure describing the signing context you want to create | 
This allocates and returns a signing context created according to what is in the info parameter.
info must be prepared with the lws_context, a keyset to use, a CBOR output context, and the inline payload length.
Returns NULL on failure or the created signing context ready to add alg(s) to.
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN int lws_cose_sign_add | ( | struct lws_cose_sign_context * | csc, | 
| cose_param_t | alg, | ||
| const lws_cose_key_t * | ck ) | 
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN enum lws_lec_pctx_ret lws_cose_sign_payload_chunk | ( | struct lws_cose_sign_context * | csc, | 
| const uint8_t * | in, | ||
| size_t | in_len ) | 
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN void lws_cose_sign_destroy | ( | struct lws_cose_sign_context ** | csc | ) |