Rhonabwy: include/rhonabwy.h Source File

Rhonabwy Create, modify, parse or export Json Web Keys as defined in the RFC 7517

rhonabwy.h
Go to the documentation of this file.
1
25 #ifndef __RHONABWY_H_
26 #define __RHONABWY_H_
27
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32
33 #include "rhonabwy-cfg.h"
34
35 #include <jansson.h>
36 #include <gnutls/gnutls.h>
37
44 #define RHN_OK 0
45 #define RHN_ERROR 1
46 #define RHN_ERROR_MEMORY 2
47 #define RHN_ERROR_PARAM 3
48 #define RHN_ERROR_UNSUPPORTED 4
49 #define RHN_ERROR_INVALID 5
50
51 #define R_X509_TYPE_PUBKEY 1
52 #define R_X509_TYPE_PRIVKEY 2
53 #define R_X509_TYPE_CERTIFICATE 3
54
55 #define R_FORMAT_PEM 0
56 #define R_FORMAT_DER 1
57
58 #define R_KEY_TYPE_NONE 0x00000000
59 #define R_KEY_TYPE_PUBLIC 0x00000001
60 #define R_KEY_TYPE_PRIVATE 0x00000010
61 #define R_KEY_TYPE_SYMMETRIC 0x00000100
62 #define R_KEY_TYPE_RSA 0x00001000
63 #define R_KEY_TYPE_ECDSA 0x00010000
64 #define R_KEY_TYPE_HMAC 0x00100000
65 #define R_KEY_TYPE_EDDSA 0x01000000
66
67 #define R_FLAG_IGNORE_SERVER_CERTIFICATE 0x00000001
68 #define R_FLAG_FOLLOW_REDIRECT 0x00000010
69 #define R_FLAG_IGNORE_REMOTE 0x00000100
70
71 #define R_JWT_TYPE_NONE 0
72 #define R_JWT_TYPE_SIGN 1
73 #define R_JWT_TYPE_ENCRYPT 2
74 #define R_JWT_TYPE_NESTED_SIGN_THEN_ENCRYPT 3
75 #define R_JWT_TYPE_NESTED_ENCRYPT_THEN_SIGN 4
76
77 #define R_JWT_CLAIM_NOP 0
78 #define R_JWT_CLAIM_ISS 1
79 #define R_JWT_CLAIM_SUB 2
80 #define R_JWT_CLAIM_AUD 3
81 #define R_JWT_CLAIM_EXP 4
82 #define R_JWT_CLAIM_NBF 5
83 #define R_JWT_CLAIM_IAT 6
84 #define R_JWT_CLAIM_JTI 7
85 #define R_JWT_CLAIM_STR 8
86 #define R_JWT_CLAIM_INT 9
87 #define R_JWT_CLAIM_JSN 10
88
89 #define R_JWT_CLAIM_NOW -1
90 #define R_JWT_CLAIM_PRESENT -2
91
92 #define R_JWK_THUMB_SHA256 0
93 #define R_JWK_THUMB_SHA384 1
94 #define R_JWK_THUMB_SHA512 2
95
106 typedef json_t jwk_t;
107 typedef json_t jwks_t;
108
109 typedef enum {
110 R_JWA_ALG_UNKNOWN = 0,
111 R_JWA_ALG_NONE = 1,
112 R_JWA_ALG_HS256 = 2,
113 R_JWA_ALG_HS384 = 3,
114 R_JWA_ALG_HS512 = 4,
115 R_JWA_ALG_RS256 = 5,
116 R_JWA_ALG_RS384 = 6,
117 R_JWA_ALG_RS512 = 7,
118 R_JWA_ALG_ES256 = 8,
119 R_JWA_ALG_ES384 = 9,
120 R_JWA_ALG_ES512 = 10,
121 R_JWA_ALG_EDDSA = 11,
122 R_JWA_ALG_PS256 = 12,
123 R_JWA_ALG_PS384 = 13,
124 R_JWA_ALG_PS512 = 14,
125 R_JWA_ALG_RSA1_5 = 15,
126 R_JWA_ALG_RSA_OAEP = 16,
127 R_JWA_ALG_RSA_OAEP_256 = 17,
128 R_JWA_ALG_A128KW = 18,
129 R_JWA_ALG_A192KW = 19,
130 R_JWA_ALG_A256KW = 20,
131 R_JWA_ALG_DIR = 21,
132 R_JWA_ALG_ECDH_ES = 22,
133 R_JWA_ALG_ECDH_ES_A128KW = 23,
134 R_JWA_ALG_ECDH_ES_A192KW = 24,
135 R_JWA_ALG_ECDH_ES_A256KW = 25,
136 R_JWA_ALG_A128GCMKW = 26,
137 R_JWA_ALG_A192GCMKW = 27,
138 R_JWA_ALG_A256GCMKW = 28,
139 R_JWA_ALG_PBES2_H256 = 29,
140 R_JWA_ALG_PBES2_H384 = 30,
141 R_JWA_ALG_PBES2_H512 = 31,
142 R_JWA_ALG_ES256K = 32
143 } jwa_alg;
144
145 typedef enum {
146 R_JWA_ENC_UNKNOWN = 0,
147 R_JWA_ENC_A128CBC = 1,
148 R_JWA_ENC_A192CBC = 2,
149 R_JWA_ENC_A256CBC = 3,
150 R_JWA_ENC_A128GCM = 4,
151 R_JWA_ENC_A192GCM = 5,
152 R_JWA_ENC_A256GCM = 6
153 } jwa_enc;
154
155 typedef struct {
156 unsigned char * header_b64url;
157 unsigned char * payload_b64url;
158 unsigned char * signature_b64url;
159 json_t * j_header;
160 jwa_alg alg;
161 jwks_t * jwks_privkey;
162 jwks_t * jwks_pubkey;
163 unsigned char * payload;
164 size_t payload_len;
165 } jws_t;
166
167 typedef struct {
168 unsigned char * header_b64url;
169 unsigned char * encrypted_key_b64url;
170 unsigned char * iv_b64url;
171 unsigned char * ciphertext_b64url;
172 unsigned char * auth_tag_b64url;
173 json_t * j_header;
174 jwa_alg alg;
175 jwa_enc enc;
176 jwks_t * jwks_privkey;
177 jwks_t * jwks_pubkey;
178 unsigned char * key;
179 size_t key_len;
180 unsigned char * iv;
181 size_t iv_len;
182 unsigned char * payload;
183 size_t payload_len;
184 } jwe_t;
185
186 typedef struct {
187 int type;
188 json_t * j_header;
189 json_t * j_claims;
190 jws_t * jws;
191 jwe_t * jwe;
192 jwa_alg sign_alg;
193 jwa_alg enc_alg;
194 jwa_enc enc;
195 jwks_t * jwks_privkey_sign;
196 jwks_t * jwks_pubkey_sign;
197 jwks_t * jwks_privkey_enc;
198 jwks_t * jwks_pubkey_enc;
199 } jwt_t;
200
218 int r_global_init();
219
223 void r_global_close();
224
232 json_t * r_library_info_json_t();
233
241 char * r_library_info_json_str();
242
248 void r_free(void * data);
249
255 int r_jwk_init(jwk_t ** jwk);
256
261 void r_jwk_free(jwk_t * jwk);
262
268 int r_jwks_init(jwks_t ** jwks);
269
274 void r_jwks_free(jwks_t * jwks);
275
281 int r_jws_init(jws_t ** jws);
282
287 void r_jws_free(jws_t * jws);
288
294 int r_jwe_init(jwe_t ** jwe);
295
300 void r_jwe_free(jwe_t * jwe);
301
307 int r_jwt_init(jwt_t ** jwt);
308
313 void r_jwt_free(jwt_t * jwt);
314
320 jwa_alg r_str_to_jwa_alg(const char * alg);
321
328 const char * r_jwa_alg_to_str(jwa_alg alg);
329
335 jwa_enc r_str_to_jwa_enc(const char * enc);
336
343 const char * r_jwa_enc_to_str(jwa_enc enc);
344
380 int r_jwk_key_type(jwk_t * jwk, unsigned int * bits, int x5u_flags);
381
388 int r_jwk_is_valid(jwk_t * jwk);
389
402 int r_jwk_is_valid_x5u(jwk_t * jwk, int x5u_flags);
403
415 int r_jwk_generate_key_pair(jwk_t * jwk_privkey, jwk_t * jwk_pubkey, int type, unsigned int bits, const char * kid);
416
433 const char * r_jwk_get_property_str(jwk_t * jwk, const char * key);
434
442 const char * r_jwk_get_property_array(jwk_t * jwk, const char * key, size_t index);
443
450 int r_jwk_get_property_array_size(jwk_t * jwk, const char * key);
451
460 int r_jwk_set_property_str(jwk_t * jwk, const char * key, const char * value);
461
471 int r_jwk_set_property_array(jwk_t * jwk, const char * key, size_t index, const char * value);
472
481 int r_jwk_append_property_array(jwk_t * jwk, const char * key, const char * value);
482
490 int r_jwk_delete_property_str(jwk_t * jwk, const char * key);
491
500 int r_jwk_delete_property_array_at(jwk_t * jwk, const char * key, size_t index);
501
511 int r_jwk_append_x5c(jwk_t * jwk, int format, const unsigned char * input, size_t input_len);
512
530 int r_jwk_import_from_json_str(jwk_t * jwk, const char * input);
531
539 int r_jwk_import_from_json_t(jwk_t * jwk, json_t * j_input);
540
551 int r_jwk_import_from_pem_der(jwk_t * jwk, int type, int format, const unsigned char * input, size_t input_len);
552
560 int r_jwk_import_from_gnutls_privkey(jwk_t * jwk, gnutls_privkey_t key);
561
569 int r_jwk_import_from_gnutls_pubkey(jwk_t * jwk, gnutls_pubkey_t pub);
570
578 int r_jwk_import_from_gnutls_x509_crt(jwk_t * jwk, gnutls_x509_crt_t crt);
579
591 int r_jwk_import_from_x5u(jwk_t * jwk, int x5u_flags, const char * x5u);
592
601 int r_jwk_import_from_symmetric_key(jwk_t * jwk, const unsigned char * key, size_t key_len);
602
615 int r_jwk_extract_pubkey(jwk_t * jwk_privkey, jwk_t * jwk_pubkey, int x5u_flags);
616
622 jwk_t * r_jwk_copy(jwk_t * jwk);
623
630 int r_jwk_equal(jwk_t * jwk1, jwk_t * jwk2);
631
648 char * r_jwk_export_to_json_str(jwk_t * jwk, int pretty);
649
655 json_t * r_jwk_export_to_json_t(jwk_t * jwk);
656
662 gnutls_privkey_t r_jwk_export_to_gnutls_privkey(jwk_t * jwk);
663
675 gnutls_pubkey_t r_jwk_export_to_gnutls_pubkey(jwk_t * jwk, int x5u_flags);
676
690 gnutls_x509_crt_t r_jwk_export_to_gnutls_crt(jwk_t * jwk, int x5u_flags);
691
707 int r_jwk_export_to_pem_der(jwk_t * jwk, int format, unsigned char * output, size_t * output_len, int x5u_flags);
708
717 int r_jwk_export_to_symmetric_key(jwk_t * jwk, unsigned char * key, size_t * key_len);
718
735 char * r_jwk_thumbprint(jwk_t * jwk, int hash, int x5u_flags);
736
749 int r_jwk_validate_x5c_chain(jwk_t * jwk, int x5u_flags);
750
768 int r_jwks_is_valid(jwks_t * jwks);
769
779 int r_jwks_import_from_str(jwks_t * jwks, const char * input);
780
790 int r_jwks_import_from_json_t(jwks_t * jwks, json_t * j_input);
791
805 int r_jwks_import_from_uri(jwks_t * jwks, const char * uri, int flags);
806
812 jwks_t * r_jwks_copy(jwks_t * jwks);
813
819 size_t r_jwks_size(jwks_t * jwks);
820
828 jwk_t * r_jwks_get_at(jwks_t * jwks, size_t index);
829
837 jwk_t * r_jwks_get_by_kid(jwks_t * jwks, const char * kid);
838
845 int r_jwks_append_jwk(jwks_t * jwks, jwk_t * jwk);
846
854 int r_jwks_set_at(jwks_t * jwks, size_t index, jwk_t * jwk);
855
862 int r_jwks_remove_at(jwks_t * jwks, size_t index);
863
869 int r_jwks_empty(jwks_t * jwks);
870
878 int r_jwks_equal(jwks_t * jwks1, jwks_t * jwks2);
879
886 char * r_jwks_export_to_json_str(jwks_t * jwks, int pretty);
887
893 json_t * r_jwks_export_to_json_t(jwks_t * jwks);
894
902 gnutls_privkey_t * r_jwks_export_to_gnutls_privkey(jwks_t * jwks, size_t * len);
903
916 gnutls_pubkey_t * r_jwks_export_to_gnutls_pubkey(jwks_t * jwks, size_t * len, int x5u_flags);
917
933 int r_jwks_export_to_pem_der(jwks_t * jwks, int format, unsigned char * output, size_t * output_len, int x5u_flags);
934
950 jws_t * r_jws_copy(jws_t * jws);
951
959 int r_jws_set_payload(jws_t * jws, const unsigned char * payload, size_t payload_len);
960
967 const unsigned char * r_jws_get_payload(jws_t * jws, size_t * payload_len);
968
975 int r_jws_set_alg(jws_t * jws, jwa_alg alg);
976
982 jwa_alg r_jws_get_alg(jws_t * jws);
983
991 int r_jws_set_header_str_value(jws_t * jws, const char * key, const char * str_value);
992
1000 int r_jws_set_header_int_value(jws_t * jws, const char * key, int i_value);
1001
1009 int r_jws_set_header_json_t_value(jws_t * jws, const char * key, json_t * j_value);
1010
1017 const char * r_jws_get_header_str_value(jws_t * jws, const char * key);
1018
1025 int r_jws_get_header_int_value(jws_t * jws, const char * key);
1026
1033 json_t * r_jws_get_header_json_t_value(jws_t * jws, const char * key);
1034
1040 json_t * r_jws_get_full_header_json_t(jws_t * jws);
1041
1049 int r_jws_add_keys(jws_t * jws, jwk_t * jwk_privkey, jwk_t * jwk_pubkey);
1050
1058 int r_jws_add_jwks(jws_t * jws, jwks_t * jwks_privkey, jwks_t * jwks_pubkey);
1059
1068 int r_jws_add_keys_json_str(jws_t * jws, const char * privkey, const char * pubkey);
1069
1078 int r_jws_add_keys_json_t(jws_t * jws, json_t * privkey, json_t * pubkey);
1079
1091 int r_jws_add_keys_pem_der(jws_t * jws, int format, const unsigned char * privkey, size_t privkey_len, const unsigned char * pubkey, size_t pubkey_len);
1092
1101 int r_jws_add_keys_gnutls(jws_t * jws, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey);
1102
1110 int r_jws_add_key_symmetric(jws_t * jws, const unsigned char * key, size_t key_len);
1111
1117 jwks_t * r_jws_get_jwks_privkey(jws_t * jws);
1118
1124 jwks_t * r_jws_get_jwks_pubkey(jws_t * jws);
1125
1138 int r_jws_parse(jws_t * jws, const char * jws_str, int x5u_flags);
1139
1153 int r_jws_parsen(jws_t * jws, const char * jws_str, size_t jws_str_len, int x5u_flags);
1154
1170 int r_jws_verify_signature(jws_t * jws, jwk_t * jwk_pubkey, int x5u_flags);
1171
1185 char * r_jws_serialize(jws_t * jws, jwk_t * jwk_privkey, int x5u_flags);
1186
1202 jwe_t * r_jwe_copy(jwe_t * jwe);
1203
1211 int r_jwe_set_payload(jwe_t * jwe, const unsigned char * payload, size_t payload_len);
1212
1219 const unsigned char * r_jwe_get_payload(jwe_t * jwe, size_t * payload_len);
1220
1227 int r_jwe_set_alg(jwe_t * jwe, jwa_alg alg);
1228
1234 jwa_alg r_jwe_get_alg(jwe_t * jwe);
1235
1242 int r_jwe_set_enc(jwe_t * jwe, jwa_enc enc);
1243
1249 jwa_enc r_jwe_get_enc(jwe_t * jwe);
1250
1258 int r_jwe_set_header_str_value(jwe_t * jwe, const char * key, const char * str_value);
1259
1267 int r_jwe_set_header_int_value(jwe_t * jwe, const char * key, int i_value);
1268
1276 int r_jwe_set_header_json_t_value(jwe_t * jwe, const char * key, json_t * j_value);
1277
1284 const char * r_jwe_get_header_str_value(jwe_t * jwe, const char * key);
1285
1292 int r_jwe_get_header_int_value(jwe_t * jwe, const char * key);
1293
1300 json_t * r_jwe_get_header_json_t_value(jwe_t * jwe, const char * key);
1301
1307 json_t * r_jwe_get_full_header_json_t(jwe_t * jwe);
1308
1316 int r_jwe_add_keys(jwe_t * jwe, jwk_t * jwk_privkey, jwk_t * jwk_pubkey);
1317
1325 int r_jwe_add_jwks(jwe_t * jwe, jwks_t * jwks_privkey, jwks_t * jwks_pubkey);
1326
1335 int r_jwe_add_keys_json_str(jwe_t * jwe, const char * privkey, const char * pubkey);
1336
1345 int r_jwe_add_keys_json_t(jwe_t * jwe, json_t * privkey, json_t * pubkey);
1346
1358 int r_jwe_add_keys_pem_der(jwe_t * jwe, int format, const unsigned char * privkey, size_t privkey_len, const unsigned char * pubkey, size_t pubkey_len);
1359
1368 int r_jwe_add_keys_gnutls(jwe_t * jwe, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey);
1369
1377 int r_jwe_add_key_symmetric(jwe_t * jwe, const unsigned char * key, size_t key_len);
1378
1384 jwks_t * r_jwe_get_jwks_privkey(jwe_t * jwe);
1385
1391 jwks_t * r_jwe_get_jwks_pubkey(jwe_t * jwe);
1392
1400 int r_jwe_set_cypher_key(jwe_t * jwe, const unsigned char * key, size_t key_len);
1401
1408 const unsigned char * r_jwe_get_cypher_key(jwe_t * jwe, size_t * key_len);
1409
1415 int r_jwe_generate_cypher_key(jwe_t * jwe);
1416
1424 int r_jwe_set_iv(jwe_t * jwe, const unsigned char * iv, size_t iv_len);
1425
1432 const unsigned char * r_jwe_get_iv(jwe_t * jwe, size_t * iv_len);
1433
1439 int r_jwe_generate_iv(jwe_t * jwe);
1440
1446 int r_jwe_encrypt_payload(jwe_t * jwe);
1447
1453 int r_jwe_decrypt_payload(jwe_t * jwe);
1454
1467 int r_jwe_encrypt_key(jwe_t * jwe, jwk_t * jwk_pubkey, int x5u_flags);
1468
1481 int r_jwe_decrypt_key(jwe_t * jwe, jwk_t * jwk_privkey, int x5u_flags);
1482
1495 int r_jwe_parse(jwe_t * jwe, const char * jwe_str, int x5u_flags);
1496
1510 int r_jwe_parsen(jwe_t * jwe, const char * jwe_str, size_t jwe_str_len, int x5u_flags);
1511
1525 int r_jwe_decrypt(jwe_t * jwe, jwk_t * jwk_privkey, int x5u_flags);
1526
1540 char * r_jwe_serialize(jwe_t * jwe, jwk_t * jwk_pubkey, int x5u_flags);
1541
1557 jwt_t * r_jwt_copy(jwt_t * jwt);
1558
1566 int r_jwt_set_header_str_value(jwt_t * jwt, const char * key, const char * str_value);
1567
1575 int r_jwt_set_header_int_value(jwt_t * jwt, const char * key, int i_value);
1576
1584 int r_jwt_set_header_json_t_value(jwt_t * jwt, const char * key, json_t * j_value);
1585
1592 const char * r_jwt_get_header_str_value(jwt_t * jwt, const char * key);
1593
1600 int r_jwt_get_header_int_value(jwt_t * jwt, const char * key);
1601
1608 json_t * r_jwt_get_header_json_t_value(jwt_t * jwt, const char * key);
1609
1615 json_t * r_jwt_get_full_header_json_t(jwt_t * jwt);
1616
1622 char * r_jwt_get_full_header_str(jwt_t * jwt);
1623
1631 int r_jwt_set_claim_str_value(jwt_t * jwt, const char * key, const char * str_value);
1632
1640 int r_jwt_set_claim_int_value(jwt_t * jwt, const char * key, int i_value);
1641
1649 int r_jwt_set_claim_json_t_value(jwt_t * jwt, const char * key, json_t * j_value);
1650
1657 const char * r_jwt_get_claim_str_value(jwt_t * jwt, const char * key);
1658
1665 int r_jwt_get_claim_int_value(jwt_t * jwt, const char * key);
1666
1673 json_t * r_jwt_get_claim_json_t_value(jwt_t * jwt, const char * key);
1674
1680 json_t * r_jwt_get_full_claims_json_t(jwt_t * jwt);
1681
1687 char * r_jwt_get_full_claims_str(jwt_t * jwt);
1688
1696 int r_jwt_set_full_claims_json_t(jwt_t * jwt, json_t * j_claim);
1697
1705 int r_jwt_set_full_claims_json_str(jwt_t * jwt, const char * str_claims);
1706
1714 int r_jwt_append_claims_json_t(jwt_t * jwt, json_t * j_claim);
1715
1723 int r_jwt_add_sign_keys(jwt_t * jwt, jwk_t * privkey, jwk_t * pubkey);
1724
1732 int r_jwt_add_sign_jwks(jwt_t * jwt, jwks_t * jwks_privkey, jwks_t * jwks_pubkey);
1733
1742 int r_jwt_add_sign_keys_json_str(jwt_t * jwt, const char * privkey, const char * pubkey);
1743
1752 int r_jwt_add_sign_keys_json_t(jwt_t * jwt, json_t * privkey, json_t * pubkey);
1753
1765 int r_jwt_add_sign_keys_pem_der(jwt_t * jwt, int format, const unsigned char * privkey, size_t privkey_len, const unsigned char * pubkey, size_t pubkey_len);
1766
1775 int r_jwt_add_sign_keys_gnutls(jwt_t * jwt, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey);
1776
1784 int r_jwt_add_sign_key_symmetric(jwt_t * jwt, const unsigned char * key, size_t key_len);
1785
1791 jwks_t * r_jwt_get_sign_jwks_privkey(jwt_t * jwt);
1792
1798 jwks_t * r_jwt_get_sign_jwks_pubkey(jwt_t * jwt);
1799
1807 int r_jwt_add_enc_keys(jwt_t * jwt, jwk_t * privkey, jwk_t * pubkey);
1808
1816 int r_jwt_add_enc_jwks(jwt_t * jwt, jwks_t * jwks_privkey, jwks_t * jwks_pubkey);
1817
1826 int r_jwt_add_enc_keys_json_str(jwt_t * jwt, const char * privkey, const char * pubkey);
1827
1836 int r_jwt_add_enc_keys_json_t(jwt_t * jwt, json_t * privkey, json_t * pubkey);
1837
1849 int r_jwt_add_enc_keys_pem_der(jwt_t * jwt, int format, const unsigned char * privkey, size_t privkey_len, const unsigned char * pubkey, size_t pubkey_len);
1850
1859 int r_jwt_add_enc_keys_gnutls(jwt_t * jwt, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey);
1860
1868 int r_jwt_add_enc_key_symmetric(jwt_t * jwt, const unsigned char * key, size_t key_len);
1869
1875 jwks_t * r_jwt_get_enc_jwks_privkey(jwt_t * jwt);
1876
1882 jwks_t * r_jwt_get_enc_jwks_pubkey(jwt_t * jwt);
1883
1890 int r_jwt_set_sign_alg(jwt_t * jwt, jwa_alg alg);
1891
1897 jwa_alg r_jwt_get_sign_alg(jwt_t * jwt);
1898
1905 int r_jwt_set_enc_alg(jwt_t * jwt, jwa_alg alg);
1906
1912 jwa_alg r_jwt_get_enc_alg(jwt_t * jwt);
1913
1920 int r_jwt_set_enc(jwt_t * jwt, jwa_enc enc);
1921
1927 jwa_enc r_jwt_get_enc(jwt_t * jwt);
1928
1941 char * r_jwt_serialize_signed(jwt_t * jwt, jwk_t * privkey, int x5u_flags);
1942
1955 char * r_jwt_serialize_encrypted(jwt_t * jwt, jwk_t * pubkey, int x5u_flags);
1956
1981 char * r_jwt_serialize_nested(jwt_t * jwt, unsigned int type, jwk_t * sign_key, int sign_key_x5u_flags, jwk_t * encrypt_key, int encrypt_key_x5u_flags);
1982
1998 int r_jwt_parse(jwt_t * jwt, const char * token, int x5u_flags);
1999
2016 int r_jwt_parsen(jwt_t * jwt, const char * token, size_t token_len, int x5u_flags);
2017
2028 int r_jwt_get_type(jwt_t * jwt);
2029
2045 int r_jwt_verify_signature(jwt_t * jwt, jwk_t * pubkey, int x5u_flags);
2046
2060 int r_jwt_decrypt(jwt_t * jwt, jwk_t * privkey, int x5u_flags);
2061
2084 int r_jwt_decrypt_verify_signature_nested(jwt_t * jwt, jwk_t * verify_key, int verify_key_x5u_flags, jwk_t * decrypt_key, int decrypt_key_x5u_flags);
2085
2100 int r_jwt_decrypt_nested(jwt_t * jwt, jwk_t * decrypt_key, int decrypt_key_x5u_flags);
2101
2115 int r_jwt_verify_signature_nested(jwt_t * jwt, jwk_t * verify_key, int verify_key_x5u_flags);
2116
2143 int r_jwt_validate_claims(jwt_t * jwt, ...);
2144
2149 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2150
2154 int _r_json_set_str_value(json_t * j_json, const char * key, const char * str_value);
2155
2156 int _r_json_set_int_value(json_t * j_json, const char * key, int i_value);
2157
2158 int _r_json_set_json_t_value(json_t * j_json, const char * key, json_t * j_value);
2159
2160 const char * _r_json_get_str_value(json_t * j_json, const char * key);
2161
2162 int _r_json_get_int_value(json_t * j_json, const char * key);
2163
2164 json_t * _r_json_get_json_t_value(json_t * j_json, const char * key);
2165
2166 json_t * _r_json_get_full_json_t(json_t * j_json);
2167
2168 #endif
2169
2170 #ifdef __cplusplus
2171 }
2172 #endif
2173
2174 #endif // __RHONABWY_H_
r_jwt_verify_signature
int r_jwt_verify_signature(jwt_t *jwt, jwk_t *pubkey, int x5u_flags)
Definition: jwt.c:1157
R_JWA_ALG_ES256
@ R_JWA_ALG_ES256
Definition: rhonabwy.h:118
jwe_t::payload
unsigned char * payload
Definition: rhonabwy.h:182
r_jwe_copy
jwe_t * r_jwe_copy(jwe_t *jwe)
Definition: jwe.c:533
r_jwt_verify_signature_nested
int r_jwt_verify_signature_nested(jwt_t *jwt, jwk_t *verify_key, int verify_key_x5u_flags)
Definition: jwt.c:1477
R_JWA_ALG_NONE
@ R_JWA_ALG_NONE
Definition: rhonabwy.h:111
R_JWA_ENC_A128GCM
@ R_JWA_ENC_A128GCM
Definition: rhonabwy.h:150
r_jwks_free
void r_jwks_free(jwks_t *jwks)
Definition: jwks.c:40
r_jwe_parse
int r_jwe_parse(jwe_t *jwe, const char *jwe_str, int x5u_flags)
Definition: jwe.c:1876
r_jwt_get_sign_alg
jwa_alg r_jwt_get_sign_alg(jwt_t *jwt)
Definition: jwt.c:812
r_jws_set_header_json_t_value
int r_jws_set_header_json_t_value(jws_t *jws, const char *key, json_t *j_value)
Definition: jws.c:810
r_jwks_import_from_json_t
int r_jwks_import_from_json_t(jwks_t *jwks, json_t *j_input)
Definition: jwks.c:270
r_jwt_free
void r_jwt_free(jwt_t *jwt)
Definition: jwt.c:84
r_jws_free
void r_jws_free(jws_t *jws)
Definition: jws.c:639
r_jwks_append_jwk
int r_jwks_append_jwk(jwks_t *jwks, jwk_t *jwk)
Definition: jwks.c:104
r_jwe_set_enc
int r_jwe_set_enc(jwe_t *jwe, jwa_enc enc)
Definition: jwe.c:829
r_jwks_export_to_json_t
json_t * r_jwks_export_to_json_t(jwks_t *jwks)
Definition: jwks.c:168
R_JWA_ENC_UNKNOWN
@ R_JWA_ENC_UNKNOWN
Definition: rhonabwy.h:146
r_jwt_add_sign_keys_json_str
int r_jwt_add_sign_keys_json_str(jwt_t *jwt, const char *privkey, const char *pubkey)
Definition: jwt.c:347
jwe_t::jwks_pubkey
jwks_t * jwks_pubkey
Definition: rhonabwy.h:177
r_jwk_import_from_symmetric_key
int r_jwk_import_from_symmetric_key(jwk_t *jwk, const unsigned char *key, size_t key_len)
Definition: jwk.c:1548
jws_t::header_b64url
unsigned char * header_b64url
Definition: rhonabwy.h:156
R_JWA_ALG_ES256K
@ R_JWA_ALG_ES256K
Definition: rhonabwy.h:142
r_jwk_get_property_array_size
int r_jwk_get_property_array_size(jwk_t *jwk, const char *key)
Definition: jwk.c:2379
R_JWA_ENC_A192CBC
@ R_JWA_ENC_A192CBC
Definition: rhonabwy.h:148
r_jwk_export_to_json_str
char * r_jwk_export_to_json_str(jwk_t *jwk, int pretty)
Definition: jwk.c:1589
r_jwk_key_type
int r_jwk_key_type(jwk_t *jwk, unsigned int *bits, int x5u_flags)
Definition: jwk.c:515
r_jwk_get_property_str
const char * r_jwk_get_property_str(jwk_t *jwk, const char *key)
Definition: jwk.c:2354
R_JWA_ALG_A128KW
@ R_JWA_ALG_A128KW
Definition: rhonabwy.h:128
R_JWA_ALG_DIR
@ R_JWA_ALG_DIR
Definition: rhonabwy.h:131
r_jwt_copy
jwt_t * r_jwt_copy(jwt_t *jwt)
Definition: jwt.c:98
r_jws_verify_signature
int r_jws_verify_signature(jws_t *jws, jwk_t *jwk_pubkey, int x5u_flags)
Definition: jws.c:1212
jwt_t
Definition: rhonabwy.h:186
r_jwks_export_to_gnutls_pubkey
gnutls_pubkey_t * r_jwks_export_to_gnutls_pubkey(jwks_t *jwks, size_t *len, int x5u_flags)
Definition: jwks.c:198
jwe_t::alg
jwa_alg alg
Definition: rhonabwy.h:174
r_jwt_serialize_encrypted
char * r_jwt_serialize_encrypted(jwt_t *jwt, jwk_t *pubkey, int x5u_flags)
Definition: jwt.c:901
r_jwe_serialize
char * r_jwe_serialize(jwe_t *jwe, jwk_t *jwk_pubkey, int x5u_flags)
Definition: jwe.c:1892
r_jwk_get_property_array
const char * r_jwk_get_property_array(jwk_t *jwk, const char *key, size_t index)
Definition: jwk.c:2366
r_jwt_get_enc_alg
jwa_alg r_jwt_get_enc_alg(jwt_t *jwt)
Definition: jwt.c:832
r_jwt_add_sign_keys_json_t
int r_jwt_add_sign_keys_json_t(jwt_t *jwt, json_t *privkey, json_t *pubkey)
Definition: jwt.c:386
jwt_t::type
int type
Definition: rhonabwy.h:187
jws_t
Definition: rhonabwy.h:155
r_jwt_get_enc_jwks_privkey
jwks_t * r_jwt_get_enc_jwks_privkey(jwt_t *jwt)
Definition: jwt.c:784
r_str_to_jwa_enc
jwa_enc r_str_to_jwa_enc(const char *enc)
Definition: misc.c:304
r_jws_add_keys_json_str
int r_jws_add_keys_json_str(jws_t *jws, const char *privkey, const char *pubkey)
Definition: jws.c:912
jwt_t::jwks_privkey_enc
jwks_t * jwks_privkey_enc
Definition: rhonabwy.h:197
r_jwks_get_by_kid
jwk_t * r_jwks_get_by_kid(jwks_t *jwks, const char *kid)
Definition: jwks.c:83
r_jwe_set_header_int_value
int r_jwe_set_header_int_value(jwe_t *jwe, const char *key, int i_value)
Definition: jwe.c:887
r_jwe_set_iv
int r_jwe_set_iv(jwe_t *jwe, const unsigned char *iv, size_t iv_len)
Definition: jwe.c:667
r_jwe_add_keys_gnutls
int r_jwe_add_keys_gnutls(jwe_t *jwe, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey)
Definition: jwe.c:1120
r_jwks_equal
int r_jwks_equal(jwks_t *jwks1, jwks_t *jwks2)
Definition: jwks.c:156
r_jwt_get_header_int_value
int r_jwt_get_header_int_value(jwt_t *jwt, const char *key)
Definition: jwt.c:154
r_jwt_get_enc
jwa_enc r_jwt_get_enc(jwt_t *jwt)
Definition: jwt.c:852
r_jws_parse
int r_jws_parse(jws_t *jws, const char *jws_str, int x5u_flags)
Definition: jws.c:1208
jws_t::signature_b64url
unsigned char * signature_b64url
Definition: rhonabwy.h:158
jwe_t::enc
jwa_enc enc
Definition: rhonabwy.h:175
r_jwt_set_enc
int r_jwt_set_enc(jwt_t *jwt, jwa_enc enc)
Definition: jwt.c:840
r_jwk_export_to_pem_der
int r_jwk_export_to_pem_der(jwk_t *jwk, int format, unsigned char *output, size_t *output_len, int x5u_flags)
Definition: jwk.c:2270
r_jwks_import_from_str
int r_jwks_import_from_str(jwks_t *jwks, const char *input)
Definition: jwks.c:247
r_jwt_get_enc_jwks_pubkey
jwks_t * r_jwt_get_enc_jwks_pubkey(jwt_t *jwt)
Definition: jwt.c:792
R_JWA_ALG_PS512
@ R_JWA_ALG_PS512
Definition: rhonabwy.h:124
r_jwe_set_payload
int r_jwe_set_payload(jwe_t *jwe, const unsigned char *payload, size_t payload_len)
Definition: jwe.c:565
r_jwe_generate_iv
int r_jwe_generate_iv(jwe_t *jwe)
Definition: jwe.c:704
r_jwt_set_header_str_value
int r_jwt_set_header_str_value(jwt_t *jwt, const char *key, const char *str_value)
Definition: jwt.c:123
r_library_info_json_str
char * r_library_info_json_str()
Definition: misc.c:388
r_jwe_get_enc
jwa_enc r_jwe_get_enc(jwe_t *jwe)
Definition: jwe.c:865
r_jwk_equal
int r_jwk_equal(jwk_t *jwk1, jwk_t *jwk2)
Definition: jwk.c:1585
r_jwt_add_enc_keys_pem_der
int r_jwt_add_enc_keys_pem_der(jwt_t *jwt, int format, const unsigned char *privkey, size_t privkey_len, const unsigned char *pubkey, size_t pubkey_len)
Definition: jwt.c:681
jwks_t
json_t jwks_t
Definition: rhonabwy.h:107
r_jws_add_keys_pem_der
int r_jws_add_keys_pem_der(jws_t *jws, int format, const unsigned char *privkey, size_t privkey_len, const unsigned char *pubkey, size_t pubkey_len)
Definition: jws.c:990
R_JWA_ALG_RS512
@ R_JWA_ALG_RS512
Definition: rhonabwy.h:117
R_JWA_ALG_HS512
@ R_JWA_ALG_HS512
Definition: rhonabwy.h:114
r_jwt_set_enc_alg
int r_jwt_set_enc_alg(jwt_t *jwt, jwa_alg alg)
Definition: jwt.c:820
r_jwks_export_to_gnutls_privkey
gnutls_privkey_t * r_jwks_export_to_gnutls_privkey(jwks_t *jwks, size_t *len)
Definition: jwks.c:176
r_jws_add_jwks
int r_jws_add_jwks(jws_t *jws, jwks_t *jwks_privkey, jwks_t *jwks_pubkey)
Definition: jws.c:879
r_jwk_import_from_pem_der
int r_jwk_import_from_pem_der(jwk_t *jwk, int type, int format, const unsigned char *input, size_t input_len)
Definition: jwk.c:789
r_jwt_decrypt_nested
int r_jwt_decrypt_nested(jwt_t *jwt, jwk_t *decrypt_key, int decrypt_key_x5u_flags)
Definition: jwt.c:1380
jwe_t::encrypted_key_b64url
unsigned char * encrypted_key_b64url
Definition: rhonabwy.h:169
r_jwk_copy
jwk_t * r_jwk_copy(jwk_t *jwk)
Definition: jwk.c:1577
jwe_t::jwks_privkey
jwks_t * jwks_privkey
Definition: rhonabwy.h:176
jwe_t::ciphertext_b64url
unsigned char * ciphertext_b64url
Definition: rhonabwy.h:171
r_jwt_add_sign_key_symmetric
int r_jwt_add_sign_key_symmetric(jwt_t *jwt, const unsigned char *key, size_t key_len)
Definition: jwt.c:503
r_jws_get_full_header_json_t
json_t * r_jws_get_full_header_json_t(jws_t *jws)
Definition: jws.c:846
r_jwt_get_full_header_str
char * r_jwt_get_full_header_str(jwt_t *jwt)
Definition: jwt.c:175
R_JWA_ALG_PS256
@ R_JWA_ALG_PS256
Definition: rhonabwy.h:122
r_jwe_generate_cypher_key
int r_jwe_generate_cypher_key(jwe_t *jwe)
Definition: jwe.c:639
r_jwk_extract_pubkey
int r_jwk_extract_pubkey(jwk_t *jwk_privkey, jwk_t *jwk_pubkey, int x5u_flags)
Definition: jwk.c:717
r_jwa_enc_to_str
const char * r_jwa_enc_to_str(jwa_enc enc)
Definition: misc.c:322
r_jwt_get_claim_str_value
const char * r_jwt_get_claim_str_value(jwt_t *jwt, const char *key)
Definition: jwt.c:207
r_jwt_set_sign_alg
int r_jwt_set_sign_alg(jwt_t *jwt, jwa_alg alg)
Definition: jwt.c:800
r_jwks_is_valid
int r_jwks_is_valid(jwks_t *jwks)
Definition: jwks.c:46
jwt_t::j_claims
json_t * j_claims
Definition: rhonabwy.h:189
jwe_t::iv_len
size_t iv_len
Definition: rhonabwy.h:181
r_jwt_set_header_int_value
int r_jwt_set_header_int_value(jwt_t *jwt, const char *key, int i_value)
Definition: jwt.c:131
r_global_init
int r_global_init()
Definition: misc.c:29
R_JWA_ALG_PBES2_H384
@ R_JWA_ALG_PBES2_H384
Definition: rhonabwy.h:140
r_jwe_decrypt_key
int r_jwe_decrypt_key(jwe_t *jwe, jwk_t *jwk_privkey, int x5u_flags)
Definition: jwe.c:1642
r_jwks_remove_at
int r_jwks_remove_at(jwks_t *jwks, size_t index)
Definition: jwks.c:130
jwe_t::payload_len
size_t payload_len
Definition: rhonabwy.h:183
r_jwe_add_key_symmetric
int r_jwe_add_key_symmetric(jwe_t *jwe, const unsigned char *key, size_t key_len)
Definition: jwe.c:1159
r_jwe_encrypt_key
int r_jwe_encrypt_key(jwe_t *jwe, jwk_t *jwk_pubkey, int x5u_flags)
Definition: jwe.c:1518
r_jwe_get_jwks_pubkey
jwks_t * r_jwe_get_jwks_pubkey(jwe_t *jwe)
Definition: jwe.c:1192
r_jwt_parsen
int r_jwt_parsen(jwt_t *jwt, const char *token, size_t token_len, int x5u_flags)
Definition: jwt.c:1018
r_jws_add_keys_gnutls
int r_jws_add_keys_gnutls(jws_t *jws, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey)
Definition: jws.c:1029
r_jwt_set_claim_int_value
int r_jwt_set_claim_int_value(jwt_t *jwt, const char *key, int i_value)
Definition: jwt.c:191
r_jwe_set_header_json_t_value
int r_jwe_set_header_json_t_value(jwe_t *jwe, const char *key, json_t *j_value)
Definition: jwe.c:901
R_JWA_ALG_UNKNOWN
@ R_JWA_ALG_UNKNOWN
Definition: rhonabwy.h:110
jwt_t::enc
jwa_enc enc
Definition: rhonabwy.h:194
_r_json_get_str_value
const char * _r_json_get_str_value(json_t *j_json, const char *key)
Definition: misc.c:100
r_jwk_set_property_array
int r_jwk_set_property_array(jwk_t *jwk, const char *key, size_t index, const char *value)
Definition: jwk.c:2405
R_JWA_ALG_A192KW
@ R_JWA_ALG_A192KW
Definition: rhonabwy.h:129
r_jwt_add_sign_keys_gnutls
int r_jwt_add_sign_keys_gnutls(jwt_t *jwt, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey)
Definition: jwt.c:464
R_JWA_ENC_A192GCM
@ R_JWA_ENC_A192GCM
Definition: rhonabwy.h:151
R_JWA_ENC_A256CBC
@ R_JWA_ENC_A256CBC
Definition: rhonabwy.h:149
r_jwt_get_full_claims_json_t
json_t * r_jwt_get_full_claims_json_t(jwt_t *jwt)
Definition: jwt.c:228
jwt_t::sign_alg
jwa_alg sign_alg
Definition: rhonabwy.h:192
jwa_enc
jwa_enc
Definition: rhonabwy.h:145
r_jwt_decrypt
int r_jwt_decrypt(jwt_t *jwt, jwk_t *privkey, int x5u_flags)
Definition: jwt.c:1182
r_jwe_init
int r_jwe_init(jwe_t **jwe)
Definition: jwe.c:468
_r_json_set_str_value
int _r_json_set_str_value(json_t *j_json, const char *key, const char *str_value)
Definition: misc.c:42
r_jwt_add_enc_key_symmetric
int r_jwt_add_enc_key_symmetric(jwt_t *jwt, const unsigned char *key, size_t key_len)
Definition: jwt.c:759
r_jwt_decrypt_verify_signature_nested
int r_jwt_decrypt_verify_signature_nested(jwt_t *jwt, jwk_t *verify_key, int verify_key_x5u_flags, jwk_t *decrypt_key, int decrypt_key_x5u_flags)
Definition: jwt.c:1236
jwe_t::key_len
size_t key_len
Definition: rhonabwy.h:179
r_jwe_get_iv
const unsigned char * r_jwe_get_iv(jwe_t *jwe, size_t *iv_len)
Definition: jwe.c:694
r_jwe_encrypt_payload
int r_jwe_encrypt_payload(jwe_t *jwe)
Definition: jwe.c:1200
r_jwk_import_from_x5u
int r_jwk_import_from_x5u(jwk_t *jwk, int x5u_flags, const char *x5u)
Definition: jwk.c:1515
R_JWA_ALG_EDDSA
@ R_JWA_ALG_EDDSA
Definition: rhonabwy.h:121
_r_json_get_full_json_t
json_t * _r_json_get_full_json_t(json_t *j_json)
Definition: misc.c:123
r_jws_copy
jws_t * r_jws_copy(jws_t *jws)
Definition: jws.c:652
r_jwe_parsen
int r_jwe_parsen(jwe_t *jwe, const char *jwe_str, size_t jwe_str_len, int x5u_flags)
Definition: jwe.c:1763
r_jwe_get_jwks_privkey
jwks_t * r_jwe_get_jwks_privkey(jwe_t *jwe)
Definition: jwe.c:1184
jwt_t::jwks_privkey_sign
jwks_t * jwks_privkey_sign
Definition: rhonabwy.h:195
r_jwt_get_full_header_json_t
json_t * r_jwt_get_full_header_json_t(jwt_t *jwt)
Definition: jwt.c:168
r_jwks_export_to_pem_der
int r_jwks_export_to_pem_der(jwks_t *jwks, int format, unsigned char *output, size_t *output_len, int x5u_flags)
Definition: jwks.c:220
R_JWA_ALG_PS384
@ R_JWA_ALG_PS384
Definition: rhonabwy.h:123
r_jwk_import_from_gnutls_privkey
int r_jwk_import_from_gnutls_privkey(jwk_t *jwk, gnutls_privkey_t key)
Definition: jwk.c:906
jwt_t::j_header
json_t * j_header
Definition: rhonabwy.h:188
R_JWA_ALG_PBES2_H256
@ R_JWA_ALG_PBES2_H256
Definition: rhonabwy.h:139
r_jws_parsen
int r_jws_parsen(jws_t *jws, const char *jws_str, size_t jws_str_len, int x5u_flags)
Definition: jws.c:1109
R_JWA_ALG_PBES2_H512
@ R_JWA_ALG_PBES2_H512
Definition: rhonabwy.h:141
r_jwt_set_full_claims_json_t
int r_jwt_set_full_claims_json_t(jwt_t *jwt, json_t *j_claim)
Definition: jwt.c:243
R_JWA_ALG_ECDH_ES_A128KW
@ R_JWA_ALG_ECDH_ES_A128KW
Definition: rhonabwy.h:133
R_JWA_ALG_RSA1_5
@ R_JWA_ALG_RSA1_5
Definition: rhonabwy.h:125
r_global_close
void r_global_close()
Definition: misc.c:38
r_jwt_get_header_json_t_value
json_t * r_jwt_get_header_json_t_value(jwt_t *jwt, const char *key)
Definition: jwt.c:161
r_jws_get_header_int_value
int r_jws_get_header_int_value(jws_t *jws, const char *key)
Definition: jws.c:832
R_JWA_ALG_ECDH_ES_A192KW
@ R_JWA_ALG_ECDH_ES_A192KW
Definition: rhonabwy.h:134
r_str_to_jwa_alg
jwa_alg r_str_to_jwa_alg(const char *alg)
Definition: misc.c:130
r_jws_get_jwks_pubkey
jwks_t * r_jws_get_jwks_pubkey(jws_t *jws)
Definition: jws.c:1101
r_jwt_get_full_claims_str
char * r_jwt_get_full_claims_str(jwt_t *jwt)
Definition: jwt.c:235
r_jwks_empty
int r_jwks_empty(jwks_t *jwks)
Definition: jwks.c:143
r_library_info_json_t
json_t * r_library_info_json_t()
Definition: misc.c:348
_r_json_set_int_value
int _r_json_set_int_value(json_t *j_json, const char *key, int i_value)
Definition: misc.c:63
r_jwt_add_enc_keys_json_t
int r_jwt_add_enc_keys_json_t(jwt_t *jwt, json_t *privkey, json_t *pubkey)
Definition: jwt.c:642
r_jwt_get_claim_int_value
int r_jwt_get_claim_int_value(jwt_t *jwt, const char *key)
Definition: jwt.c:214
r_jwe_decrypt
int r_jwe_decrypt(jwe_t *jwe, jwk_t *jwk_privkey, int x5u_flags)
Definition: jwe.c:1880
r_jwe_decrypt_payload
int r_jwe_decrypt_payload(jwe_t *jwe)
Definition: jwe.c:1360
jwk_t
json_t jwk_t
Definition: rhonabwy.h:106
r_jwt_set_claim_str_value
int r_jwt_set_claim_str_value(jwt_t *jwt, const char *key, const char *str_value)
Definition: jwt.c:183
r_jwa_alg_to_str
const char * r_jwa_alg_to_str(jwa_alg alg)
Definition: misc.c:200
r_jwk_export_to_json_t
json_t * r_jwk_export_to_json_t(jwk_t *jwk)
Definition: jwk.c:1597
r_jws_add_keys
int r_jws_add_keys(jws_t *jws, jwk_t *jwk_privkey, jwk_t *jwk_pubkey)
Definition: jws.c:853
R_JWA_ALG_ECDH_ES_A256KW
@ R_JWA_ALG_ECDH_ES_A256KW
Definition: rhonabwy.h:135
r_jwk_generate_key_pair
int r_jwk_generate_key_pair(jwk_t *jwk_privkey, jwk_t *jwk_pubkey, int type, unsigned int bits, const char *kid)
Definition: jwk.c:412
r_jwt_add_enc_keys_gnutls
int r_jwt_add_enc_keys_gnutls(jwt_t *jwt, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey)
Definition: jwt.c:720
r_jwt_get_type
int r_jwt_get_type(jwt_t *jwt)
Definition: jwt.c:1149
r_jwks_set_at
int r_jwks_set_at(jwks_t *jwks, size_t index, jwk_t *jwk)
Definition: jwks.c:117
_r_json_get_int_value
int _r_json_get_int_value(json_t *j_json, const char *key)
Definition: misc.c:107
r_jwe_add_keys
int r_jwe_add_keys(jwe_t *jwe, jwk_t *jwk_privkey, jwk_t *jwk_pubkey)
Definition: jwe.c:944
r_jwe_add_keys_json_str
int r_jwe_add_keys_json_str(jwe_t *jwe, const char *privkey, const char *pubkey)
Definition: jwe.c:1003
r_jws_add_keys_json_t
int r_jws_add_keys_json_t(jws_t *jws, json_t *privkey, json_t *pubkey)
Definition: jws.c:951
R_JWA_ALG_HS256
@ R_JWA_ALG_HS256
Definition: rhonabwy.h:112
r_jwt_set_claim_json_t_value
int r_jwt_set_claim_json_t_value(jwt_t *jwt, const char *key, json_t *j_value)
Definition: jwt.c:199
jwt_t::jws
jws_t * jws
Definition: rhonabwy.h:190
R_JWA_ALG_A256GCMKW
@ R_JWA_ALG_A256GCMKW
Definition: rhonabwy.h:138
r_jwk_import_from_gnutls_x509_crt
int r_jwk_import_from_gnutls_x509_crt(jwk_t *jwk, gnutls_x509_crt_t crt)
Definition: jwk.c:1479
r_jwk_set_property_str
int r_jwk_set_property_str(jwk_t *jwk, const char *key, const char *value)
Definition: jwk.c:2392
r_jws_set_alg
int r_jws_set_alg(jws_t *jws, jwa_alg alg)
Definition: jws.c:714
r_jwks_size
size_t r_jwks_size(jwks_t *jwks)
Definition: jwks.c:67
r_jwe_free
void r_jwe_free(jwe_t *jwe)
Definition: jwe.c:516
r_jwk_delete_property_str
int r_jwk_delete_property_str(jwk_t *jwk, const char *key)
Definition: jwk.c:2447
jwt_t::jwks_pubkey_sign
jwks_t * jwks_pubkey_sign
Definition: rhonabwy.h:196
r_jwt_append_claims_json_t
int r_jwt_append_claims_json_t(jwt_t *jwt, json_t *j_claim)
Definition: jwt.c:270
r_jwt_add_enc_keys_json_str
int r_jwt_add_enc_keys_json_str(jwt_t *jwt, const char *privkey, const char *pubkey)
Definition: jwt.c:603
r_jwks_copy
jwks_t * r_jwks_copy(jwks_t *jwks)
Definition: jwks.c:96
r_jws_serialize
char * r_jws_serialize(jws_t *jws, jwk_t *jwk_privkey, int x5u_flags)
Definition: jws.c:1288
r_jwe_set_header_str_value
int r_jwe_set_header_str_value(jwe_t *jwe, const char *key, const char *str_value)
Definition: jwe.c:873
r_jwks_init
int r_jwks_init(jwks_t **jwks)
Definition: jwks.c:29
R_JWA_ALG_ES512
@ R_JWA_ALG_ES512
Definition: rhonabwy.h:120
r_jwt_add_sign_keys
int r_jwt_add_sign_keys(jwt_t *jwt, jwk_t *privkey, jwk_t *pubkey)
Definition: jwt.c:288
r_jws_set_header_str_value
int r_jws_set_header_str_value(jws_t *jws, const char *key, const char *str_value)
Definition: jws.c:782
r_jwt_add_sign_jwks
int r_jwt_add_sign_jwks(jwt_t *jwt, jwks_t *jwks_privkey, jwks_t *jwks_pubkey)
Definition: jwt.c:314
r_jwt_get_header_str_value
const char * r_jwt_get_header_str_value(jwt_t *jwt, const char *key)
Definition: jwt.c:147
r_jwk_export_to_gnutls_privkey
gnutls_privkey_t r_jwk_export_to_gnutls_privkey(jwk_t *jwk)
Definition: jwk.c:1605
jwt_t::jwks_pubkey_enc
jwks_t * jwks_pubkey_enc
Definition: rhonabwy.h:198
r_jwe_get_payload
const unsigned char * r_jwe_get_payload(jwe_t *jwe, size_t *payload_len)
Definition: jwe.c:592
jws_t::j_header
json_t * j_header
Definition: rhonabwy.h:159
R_JWA_ALG_A128GCMKW
@ R_JWA_ALG_A128GCMKW
Definition: rhonabwy.h:136
r_jwks_import_from_uri
int r_jwks_import_from_uri(jwks_t *jwks, const char *uri, int flags)
Definition: jwks.c:299
r_jwks_export_to_json_str
char * r_jwks_export_to_json_str(jwks_t *jwks, int pretty)
Definition: jwks.c:160
jwt_t::enc_alg
jwa_alg enc_alg
Definition: rhonabwy.h:193
r_jwk_thumbprint
char * r_jwk_thumbprint(jwk_t *jwk, int hash, int x5u_flags)
Definition: jwk.c:2519
r_jwt_serialize_signed
char * r_jwt_serialize_signed(jwt_t *jwt, jwk_t *privkey, int x5u_flags)
Definition: jwt.c:860
r_jwk_validate_x5c_chain
int r_jwk_validate_x5c_chain(jwk_t *jwk, int x5u_flags)
Definition: jwk.c:2609
jwa_alg
jwa_alg
Definition: rhonabwy.h:109
R_JWA_ENC_A128CBC
@ R_JWA_ENC_A128CBC
Definition: rhonabwy.h:147
r_jwe_get_header_str_value
const char * r_jwe_get_header_str_value(jwe_t *jwe, const char *key)
Definition: jwe.c:916
R_JWA_ALG_A256KW
@ R_JWA_ALG_A256KW
Definition: rhonabwy.h:130
r_jwk_init
int r_jwk_init(jwk_t **jwk)
Definition: jwk.c:35
r_jwt_add_enc_keys
int r_jwt_add_enc_keys(jwt_t *jwt, jwk_t *privkey, jwk_t *pubkey)
Definition: jwt.c:544
jwe_t::j_header
json_t * j_header
Definition: rhonabwy.h:173
r_jwt_get_sign_jwks_pubkey
jwks_t * r_jwt_get_sign_jwks_pubkey(jwt_t *jwt)
Definition: jwt.c:536
_r_json_set_json_t_value
int _r_json_set_json_t_value(json_t *j_json, const char *key, json_t *j_value)
Definition: misc.c:79
R_JWA_ALG_ECDH_ES
@ R_JWA_ALG_ECDH_ES
Definition: rhonabwy.h:132
jwe_t::key
unsigned char * key
Definition: rhonabwy.h:178
jws_t::jwks_pubkey
jwks_t * jwks_pubkey
Definition: rhonabwy.h:162
r_jws_set_payload
int r_jws_set_payload(jws_t *jws, const unsigned char *payload, size_t payload_len)
Definition: jws.c:679
r_jwk_import_from_json_str
int r_jwk_import_from_json_str(jwk_t *jwk, const char *input)
Definition: jwk.c:756
r_jwt_validate_claims
int r_jwt_validate_claims(jwt_t *jwt,...)
Definition: jwt.c:1509
jws_t::jwks_privkey
jwks_t * jwks_privkey
Definition: rhonabwy.h:161
r_jwk_delete_property_array_at
int r_jwk_delete_property_array_at(jwk_t *jwk, const char *key, size_t index)
Definition: jwk.c:2460
r_jwt_parse
int r_jwt_parse(jwt_t *jwt, const char *token, int x5u_flags)
Definition: jwt.c:1145
r_jwk_free
void r_jwk_free(jwk_t *jwk)
Definition: jwk.c:46
r_jwt_add_enc_jwks
int r_jwt_add_enc_jwks(jwt_t *jwt, jwks_t *jwks_privkey, jwks_t *jwks_pubkey)
Definition: jwt.c:570
jws_t::payload_b64url
unsigned char * payload_b64url
Definition: rhonabwy.h:157
r_jws_get_jwks_privkey
jwks_t * r_jws_get_jwks_privkey(jws_t *jws)
Definition: jws.c:1093
r_jwt_set_header_json_t_value
int r_jwt_set_header_json_t_value(jwt_t *jwt, const char *key, json_t *j_value)
Definition: jwt.c:139
jwe_t::auth_tag_b64url
unsigned char * auth_tag_b64url
Definition: rhonabwy.h:172
r_jws_set_header_int_value
int r_jws_set_header_int_value(jws_t *jws, const char *key, int i_value)
Definition: jws.c:796
R_JWA_ALG_RS256
@ R_JWA_ALG_RS256
Definition: rhonabwy.h:115
r_jwk_append_property_array
int r_jwk_append_property_array(jwk_t *jwk, const char *key, const char *value)
Definition: jwk.c:2429
r_jwt_get_sign_jwks_privkey
jwks_t * r_jwt_get_sign_jwks_privkey(jwt_t *jwt)
Definition: jwt.c:528
r_jws_get_header_json_t_value
json_t * r_jws_get_header_json_t_value(jws_t *jws, const char *key)
Definition: jws.c:839
r_jws_get_alg
jwa_alg r_jws_get_alg(jws_t *jws)
Definition: jws.c:774
jwe_t::iv
unsigned char * iv
Definition: rhonabwy.h:180
r_jwk_import_from_gnutls_pubkey
int r_jwk_import_from_gnutls_pubkey(jwk_t *jwk, gnutls_pubkey_t pub)
Definition: jwk.c:1274
jwt_t::jwe
jwe_t * jwe
Definition: rhonabwy.h:191
R_JWA_ALG_RS384
@ R_JWA_ALG_RS384
Definition: rhonabwy.h:116
R_JWA_ALG_RSA_OAEP
@ R_JWA_ALG_RSA_OAEP
Definition: rhonabwy.h:126
r_jwt_add_sign_keys_pem_der
int r_jwt_add_sign_keys_pem_der(jwt_t *jwt, int format, const unsigned char *privkey, size_t privkey_len, const unsigned char *pubkey, size_t pubkey_len)
Definition: jwt.c:425
R_JWA_ALG_RSA_OAEP_256
@ R_JWA_ALG_RSA_OAEP_256
Definition: rhonabwy.h:127
R_JWA_ALG_A192GCMKW
@ R_JWA_ALG_A192GCMKW
Definition: rhonabwy.h:137
r_jwe_add_jwks
int r_jwe_add_jwks(jwe_t *jwe, jwks_t *jwks_privkey, jwks_t *jwks_pubkey)
Definition: jwe.c:970
r_jwe_get_header_json_t_value
json_t * r_jwe_get_header_json_t_value(jwe_t *jwe, const char *key)
Definition: jwe.c:930
jwe_t
Definition: rhonabwy.h:167
r_jws_add_key_symmetric
int r_jws_add_key_symmetric(jws_t *jws, const unsigned char *key, size_t key_len)
Definition: jws.c:1068
R_JWA_ALG_HS384
@ R_JWA_ALG_HS384
Definition: rhonabwy.h:113
r_jwk_export_to_gnutls_crt
gnutls_x509_crt_t r_jwk_export_to_gnutls_crt(jwk_t *jwk, int x5u_flags)
Definition: jwk.c:2189
r_jwk_append_x5c
int r_jwk_append_x5c(jwk_t *jwk, int format, const unsigned char *input, size_t input_len)
Definition: jwk.c:2473
r_jwt_set_full_claims_json_str
int r_jwt_set_full_claims_json_str(jwt_t *jwt, const char *str_claims)
Definition: jwt.c:253
r_jws_get_header_str_value
const char * r_jws_get_header_str_value(jws_t *jws, const char *key)
Definition: jws.c:825
jws_t::payload_len
size_t payload_len
Definition: rhonabwy.h:164
jws_t::payload
unsigned char * payload
Definition: rhonabwy.h:163
r_jwe_set_alg
int r_jwe_set_alg(jwe_t *jwe, jwa_alg alg)
Definition: jwe.c:749
R_JWA_ALG_ES384
@ R_JWA_ALG_ES384
Definition: rhonabwy.h:119
R_JWA_ENC_A256GCM
@ R_JWA_ENC_A256GCM
Definition: rhonabwy.h:152
r_jwe_add_keys_pem_der
int r_jwe_add_keys_pem_der(jwe_t *jwe, int format, const unsigned char *privkey, size_t privkey_len, const unsigned char *pubkey, size_t pubkey_len)
Definition: jwe.c:1081
r_jwk_export_to_symmetric_key
int r_jwk_export_to_symmetric_key(jwk_t *jwk, unsigned char *key, size_t *key_len)
Definition: jwk.c:2326
r_jwt_init
int r_jwt_init(jwt_t **jwt)
Definition: jwt.c:28
jws_t::alg
jwa_alg alg
Definition: rhonabwy.h:160
r_free
void r_free(void *data)
Definition: misc.c:398
r_jws_get_payload
const unsigned char * r_jws_get_payload(jws_t *jws, size_t *payload_len)
Definition: jws.c:704
r_jwk_export_to_gnutls_pubkey
gnutls_pubkey_t r_jwk_export_to_gnutls_pubkey(jwk_t *jwk, int x5u_flags)
Definition: jwk.c:1917
r_jwks_get_at
jwk_t * r_jwks_get_at(jwks_t *jwks, size_t index)
Definition: jwks.c:75
r_jwe_get_cypher_key
const unsigned char * r_jwe_get_cypher_key(jwe_t *jwe, size_t *key_len)
Definition: jwe.c:629
jwe_t::iv_b64url
unsigned char * iv_b64url
Definition: rhonabwy.h:170
r_jwt_serialize_nested
char * r_jwt_serialize_nested(jwt_t *jwt, unsigned int type, jwk_t *sign_key, int sign_key_x5u_flags, jwk_t *encrypt_key, int encrypt_key_x5u_flags)
Definition: jwt.c:943
r_jwe_get_full_header_json_t
json_t * r_jwe_get_full_header_json_t(jwe_t *jwe)
Definition: jwe.c:937
r_jwk_is_valid_x5u
int r_jwk_is_valid_x5u(jwk_t *jwk, int x5u_flags)
Definition: jwk.c:361
r_jwe_set_cypher_key
int r_jwe_set_cypher_key(jwe_t *jwe, const unsigned char *key, size_t key_len)
Definition: jwe.c:602
r_jwe_add_keys_json_t
int r_jwe_add_keys_json_t(jwe_t *jwe, json_t *privkey, json_t *pubkey)
Definition: jwe.c:1042
r_jwe_get_alg
jwa_alg r_jwe_get_alg(jwe_t *jwe)
Definition: jwe.c:821
jwe_t::header_b64url
unsigned char * header_b64url
Definition: rhonabwy.h:168
_r_json_get_json_t_value
json_t * _r_json_get_json_t_value(json_t *j_json, const char *key)
Definition: misc.c:114
r_jwk_is_valid
int r_jwk_is_valid(jwk_t *jwk)
Definition: jwk.c:52
r_jws_init
int r_jws_init(jws_t **jws)
Definition: jws.c:598
r_jwe_get_header_int_value
int r_jwe_get_header_int_value(jwe_t *jwe, const char *key)
Definition: jwe.c:923
r_jwt_get_claim_json_t_value
json_t * r_jwt_get_claim_json_t_value(jwt_t *jwt, const char *key)
Definition: jwt.c:221
r_jwk_import_from_json_t
int r_jwk_import_from_json_t(jwk_t *jwk, json_t *j_input)
Definition: jwk.c:773