libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-gencrypto.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2020 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25/*
26 * These are gencrypto-level constants... they are used by both JOSE and direct
27 * gencrypto code. However while JWK relies on these, using gencrypto apis has
28 * no dependency at all on any JOSE type.
29 */
30
38
39/*
40 * Keytypes where the same element name is reused must all agree to put the
41 * same-named element at the same e[] index. It's because when used with jwk,
42 * we parse and store in incoming key data, but we may not be informed of the
43 * definitive keytype until the end.
44 */
45
51
71
81
88
89/* largest number of key elements for any algorithm */
90#define LWS_GENCRYPTO_MAX_KEYEL_COUNT LWS_GENCRYPTO_RSA_KEYEL_COUNT
91
92/* this "stretchy" type holds individual key element data in binary form.
93 * It's typcially used in an array with the layout mapping the element index to
94 * the key element meaning defined by the enums above. An array of these of
95 * length LWS_GENCRYPTO_MAX_KEYEL_COUNT can define key elements for any key
96 * type.
97 */
98
103
104
115
126
137lws_gencrypto_padded_length(size_t block_size, size_t len);
unsigned int uint32_t
#define LWS_EXTERN
unsigned char uint8_t
#define LWS_VISIBLE
lws_gencrypto_ec_tok
@ LWS_GENCRYPTO_EC_KEYEL_X
@ LWS_GENCRYPTO_EC_KEYEL_COUNT
@ LWS_GENCRYPTO_EC_KEYEL_D
@ LWS_GENCRYPTO_EC_KEYEL_CRV
@ LWS_GENCRYPTO_EC_KEYEL_Y
LWS_VISIBLE LWS_EXTERN int lws_base64_size(int bytes)
lws_gencrypto_oct_tok
@ LWS_GENCRYPTO_OCT_KEYEL_COUNT
@ LWS_GENCRYPTO_OCT_KEYEL_K
lws_gencrypto_rsa_tok
@ LWS_GENCRYPTO_RSA_KEYEL_D
@ LWS_GENCRYPTO_RSA_KEYEL_DP
@ LWS_GENCRYPTO_RSA_KEYEL_QI
@ LWS_GENCRYPTO_RSA_KEYEL_COUNT
@ LWS_GENCRYPTO_RSA_KEYEL_OTHER
@ LWS_GENCRYPTO_RSA_KEYEL_RI
@ LWS_GENCRYPTO_RSA_KEYEL_TI
@ LWS_GENCRYPTO_RSA_KEYEL_E
@ LWS_GENCRYPTO_RSA_KEYEL_DQ
@ LWS_GENCRYPTO_RSA_KEYEL_N
@ LWS_GENCRYPTO_RSA_KEYEL_Q
@ LWS_GENCRYPTO_RSA_KEYEL_P
@ LWS_GENCRYPTO_RSA_KEYEL_DI
lws_gencrypto_kty
@ LWS_GENCRYPTO_KTY_EC
@ LWS_GENCRYPTO_KTY_RSA
@ LWS_GENCRYPTO_KTY_UNKNOWN
@ LWS_GENCRYPTO_KTY_OCT
struct lws_gencrypto_keyelem lws_gc_elem_t
LWS_VISIBLE LWS_EXTERN int lws_gencrypto_bits_to_bytes(int bits)
lws_gencrypto_aes_tok
@ LWS_GENCRYPTO_AES_KEYEL_K
@ LWS_GENCRYPTO_AES_KEYEL_COUNT
LWS_VISIBLE LWS_EXTERN size_t lws_gencrypto_padded_length(size_t block_size, size_t len)