Rhonabwy
Javascript Object Signing and Encryption (JOSE) library - JWK, JWKS, JWS, JWE and JWT
Data Structures | Macros | Typedefs | Enumerations | Functions
rhonabwy.h File Reference

Rhonabwy JSON Web Key (JWK) library. More...

#include "rhonabwy-cfg.h"
#include <stdint.h>
#include <jansson.h>
#include <gnutls/gnutls.h>
#include <nettle/version.h>

Go to the source code of this file.

Data Structures

struct  jws_t
 
struct  jwe_t
 
struct  jwt_t
 

Macros

#define RHN_OK   0
 
#define RHN_ERROR   1
 
#define RHN_ERROR_MEMORY   2
 
#define RHN_ERROR_PARAM   3
 
#define RHN_ERROR_UNSUPPORTED   4
 
#define RHN_ERROR_INVALID   5
 
#define R_X509_TYPE_UNSPECIFIED   0
 
#define R_X509_TYPE_PUBKEY   1
 
#define R_X509_TYPE_PRIVKEY   2
 
#define R_X509_TYPE_CERTIFICATE   3
 
#define R_FORMAT_PEM   0
 
#define R_FORMAT_DER   1
 
#define R_KEY_TYPE_NONE   0x00000000
 
#define R_KEY_TYPE_PUBLIC   0x00000001
 
#define R_KEY_TYPE_PRIVATE   0x00000010
 
#define R_KEY_TYPE_SYMMETRIC   0x00000100
 
#define R_KEY_TYPE_RSA   0x00001000
 
#define R_KEY_TYPE_EC   0x00010000
 
#define R_KEY_TYPE_HMAC   0x00100000
 
#define R_KEY_TYPE_EDDSA   0x01000000
 
#define R_KEY_TYPE_ECDH   0x10000000
 
#define R_FLAG_IGNORE_SERVER_CERTIFICATE   0x00000001
 
#define R_FLAG_FOLLOW_REDIRECT   0x00000010
 
#define R_FLAG_IGNORE_REMOTE   0x00000100
 
#define R_JWT_TYPE_NONE   0
 
#define R_JWT_TYPE_SIGN   1
 
#define R_JWT_TYPE_ENCRYPT   2
 
#define R_JWT_TYPE_NESTED_SIGN_THEN_ENCRYPT   3
 
#define R_JWT_TYPE_NESTED_ENCRYPT_THEN_SIGN   4
 
#define R_JWT_CLAIM_NOW   -1
 
#define R_JWT_CLAIM_PRESENT   -2
 
#define R_JWK_THUMB_SHA256   0
 
#define R_JWK_THUMB_SHA384   1
 
#define R_JWK_THUMB_SHA512   2
 
#define R_JSON_MODE_COMPACT   0
 
#define R_JSON_MODE_GENERAL   1
 
#define R_JSON_MODE_FLATTENED   2
 
#define R_PARSE_NONE   0
 
#define R_PARSE_HEADER_JWK   1
 
#define R_PARSE_HEADER_JKU   2
 
#define R_PARSE_HEADER_X5C   4
 
#define R_PARSE_HEADER_X5U   8
 
#define R_PARSE_HEADER_ALL   (R_PARSE_HEADER_JWK|R_PARSE_HEADER_JKU|R_PARSE_HEADER_X5C|R_PARSE_HEADER_X5U)
 
#define R_PARSE_UNSIGNED   16
 
#define R_PARSE_ALL   (R_PARSE_HEADER_ALL|R_PARSE_UNSIGNED)
 
#define R_MAX_BODY_SIZE   4194304
 
#define RHONABWY_INTEGER_FORMAT   JSON_INTEGER_FORMAT
 

Typedefs

typedef json_t jwk_t
 
typedef json_t jwks_t
 
typedef json_int_t rhn_int_t
 

Enumerations

enum  jwa_alg {
  R_JWA_ALG_UNKNOWN = 0 , R_JWA_ALG_NONE = 1 , R_JWA_ALG_HS256 = 2 , R_JWA_ALG_HS384 = 3 ,
  R_JWA_ALG_HS512 = 4 , R_JWA_ALG_RS256 = 5 , R_JWA_ALG_RS384 = 6 , R_JWA_ALG_RS512 = 7 ,
  R_JWA_ALG_ES256 = 8 , R_JWA_ALG_ES384 = 9 , R_JWA_ALG_ES512 = 10 , R_JWA_ALG_EDDSA = 11 ,
  R_JWA_ALG_PS256 = 12 , R_JWA_ALG_PS384 = 13 , R_JWA_ALG_PS512 = 14 , R_JWA_ALG_RSA1_5 = 15 ,
  R_JWA_ALG_RSA_OAEP = 16 , R_JWA_ALG_RSA_OAEP_256 = 17 , R_JWA_ALG_A128KW = 18 , R_JWA_ALG_A192KW = 19 ,
  R_JWA_ALG_A256KW = 20 , R_JWA_ALG_DIR = 21 , R_JWA_ALG_ECDH_ES = 22 , R_JWA_ALG_ECDH_ES_A128KW = 23 ,
  R_JWA_ALG_ECDH_ES_A192KW = 24 , R_JWA_ALG_ECDH_ES_A256KW = 25 , R_JWA_ALG_A128GCMKW = 26 , R_JWA_ALG_A192GCMKW = 27 ,
  R_JWA_ALG_A256GCMKW = 28 , R_JWA_ALG_PBES2_H256 = 29 , R_JWA_ALG_PBES2_H384 = 30 , R_JWA_ALG_PBES2_H512 = 31 ,
  R_JWA_ALG_ES256K = 32
}
 
enum  rhn_claim_opt {
  R_JWT_CLAIM_NOP = 0 , R_JWT_CLAIM_ISS = 1 , R_JWT_CLAIM_SUB = 2 , R_JWT_CLAIM_AUD = 3 ,
  R_JWT_CLAIM_EXP = 4 , R_JWT_CLAIM_NBF = 5 , R_JWT_CLAIM_IAT = 6 , R_JWT_CLAIM_JTI = 7 ,
  R_JWT_CLAIM_STR = 8 , R_JWT_CLAIM_INT = 9 , R_JWT_CLAIM_JSN = 10 , R_JWT_CLAIM_TYP = 11 ,
  R_JWT_CLAIM_CTY = 12 , R_JWT_CLAIM_AMR = 13
}
 
enum  jwa_enc {
  R_JWA_ENC_UNKNOWN = 0 , R_JWA_ENC_A128CBC = 1 , R_JWA_ENC_A192CBC = 2 , R_JWA_ENC_A256CBC = 3 ,
  R_JWA_ENC_A128GCM = 4 , R_JWA_ENC_A192GCM = 5 , R_JWA_ENC_A256GCM = 6
}
 
enum  rhn_opt {
  RHN_OPT_NONE = 0 , RHN_OPT_HEADER_INT_VALUE = 1 , RHN_OPT_HEADER_RHN_INT_VALUE = 2 , RHN_OPT_HEADER_STR_VALUE = 3 ,
  RHN_OPT_HEADER_JSON_T_VALUE = 4 , RHN_OPT_HEADER_FULL_JSON_T = 5 , RHN_OPT_HEADER_FULL_JSON_STR = 6 , RHN_OPT_UN_HEADER_FULL_JSON_T = 7 ,
  RHN_OPT_UN_HEADER_FULL_JSON_STR = 8 , RHN_OPT_PAYLOAD = 9 , RHN_OPT_CLAIM_INT_VALUE = 10 , RHN_OPT_CLAIM_RHN_INT_VALUE = 11 ,
  RHN_OPT_CLAIM_STR_VALUE = 12 , RHN_OPT_CLAIM_JSON_T_VALUE = 13 , RHN_OPT_CLAIM_FULL_JSON_T = 14 , RHN_OPT_CLAIM_FULL_JSON_STR = 15 ,
  RHN_OPT_ENC_ALG = 16 , RHN_OPT_ENC = 17 , RHN_OPT_SIG_ALG = 18 , RHN_OPT_CIPHER_KEY = 19 ,
  RHN_OPT_IV = 20 , RHN_OPT_AAD = 21 , RHN_OPT_SIGN_KEY_JWK = 22 , RHN_OPT_SIGN_KEY_JWKS = 23 ,
  RHN_OPT_SIGN_KEY_GNUTLS = 24 , RHN_OPT_SIGN_KEY_JSON_T = 25 , RHN_OPT_SIGN_KEY_JSON_STR = 26 , RHN_OPT_SIGN_KEY_PEM_DER = 27 ,
  RHN_OPT_VERIFY_KEY_JWK = 28 , RHN_OPT_VERIFY_KEY_JWKS = 29 , RHN_OPT_VERIFY_KEY_GNUTLS = 30 , RHN_OPT_VERIFY_KEY_JSON_T = 31 ,
  RHN_OPT_VERIFY_KEY_JSON_STR = 32 , RHN_OPT_VERIFY_KEY_PEM_DER = 33 , RHN_OPT_ENCRYPT_KEY_JWK = 34 , RHN_OPT_ENCRYPT_KEY_JWKS = 35 ,
  RHN_OPT_ENCRYPT_KEY_GNUTLS = 36 , RHN_OPT_ENCRYPT_KEY_JSON_T = 37 , RHN_OPT_ENCRYPT_KEY_JSON_STR = 38 , RHN_OPT_ENCRYPT_KEY_PEM_DER = 39 ,
  RHN_OPT_DECRYPT_KEY_JWK = 40 , RHN_OPT_DECRYPT_KEY_JWKS = 41 , RHN_OPT_DECRYPT_KEY_GNUTLS = 42 , RHN_OPT_DECRYPT_KEY_JSON_T = 43 ,
  RHN_OPT_DECRYPT_KEY_JSON_STR = 44 , RHN_OPT_DECRYPT_KEY_PEM_DER = 45
}
 
enum  rhn_import {
  R_IMPORT_NONE = 0 , R_IMPORT_JSON_STR = 1 , R_IMPORT_JSON_T = 2 , R_IMPORT_PEM = 3 ,
  R_IMPORT_DER = 4 , R_IMPORT_G_PRIVKEY = 5 , R_IMPORT_G_PUBKEY = 6 , R_IMPORT_G_CERT = 7 ,
  R_IMPORT_X5U = 8 , R_IMPORT_SYMKEY = 9 , R_IMPORT_PASSWORD = 10 , R_IMPORT_JKU = 11
}
 

Functions

int r_global_init (void)
 
void r_global_close (void)
 
json_t * r_library_info_json_t (void)
 
char * r_library_info_json_str (void)
 
void r_free (void *data)
 
int r_jwk_init (jwk_t **jwk)
 
void r_jwk_free (jwk_t *jwk)
 
int r_jwks_init (jwks_t **jwks)
 
void r_jwks_free (jwks_t *jwks)
 
int r_jws_init (jws_t **jws)
 
void r_jws_free (jws_t *jws)
 
int r_jwe_init (jwe_t **jwe)
 
void r_jwe_free (jwe_t *jwe)
 
int r_jwt_init (jwt_t **jwt)
 
void r_jwt_free (jwt_t *jwt)
 
jwa_alg r_str_to_jwa_alg (const char *alg)
 
const char * r_jwa_alg_to_str (jwa_alg alg)
 
jwa_enc r_str_to_jwa_enc (const char *enc)
 
const char * r_jwa_enc_to_str (jwa_enc enc)
 
int r_jwk_key_type (jwk_t *jwk, unsigned int *bits, int x5u_flags)
 
int r_jwk_is_valid (jwk_t *jwk)
 
int r_jwk_is_valid_x5u (jwk_t *jwk, int x5u_flags)
 
int r_jwk_generate_key_pair (jwk_t *jwk_privkey, jwk_t *jwk_pubkey, int type, unsigned int bits, const char *kid)
 
const char * r_jwk_get_property_str (jwk_t *jwk, const char *key)
 
const char * r_jwk_get_property_array (jwk_t *jwk, const char *key, size_t index)
 
int r_jwk_get_property_array_size (jwk_t *jwk, const char *key)
 
int r_jwk_set_property_str (jwk_t *jwk, const char *key, const char *value)
 
int r_jwk_set_property_array (jwk_t *jwk, const char *key, size_t index, const char *value)
 
int r_jwk_append_property_array (jwk_t *jwk, const char *key, const char *value)
 
int r_jwk_delete_property_str (jwk_t *jwk, const char *key)
 
int r_jwk_delete_property_array_at (jwk_t *jwk, const char *key, size_t index)
 
int r_jwk_append_x5c (jwk_t *jwk, int format, const unsigned char *input, size_t input_len)
 
int r_jwk_import_from_json_str (jwk_t *jwk, const char *input)
 
int r_jwk_import_from_json_t (jwk_t *jwk, json_t *j_input)
 
int r_jwk_import_from_pem_der (jwk_t *jwk, int type, int format, const unsigned char *input, size_t input_len)
 
int r_jwk_import_from_gnutls_privkey (jwk_t *jwk, gnutls_privkey_t key)
 
int r_jwk_import_from_gnutls_pubkey (jwk_t *jwk, gnutls_pubkey_t pub)
 
int r_jwk_import_from_gnutls_x509_crt (jwk_t *jwk, gnutls_x509_crt_t crt)
 
int r_jwk_import_from_x5u (jwk_t *jwk, int x5u_flags, const char *x5u)
 
int r_jwk_import_from_x5c (jwk_t *jwk, const char *x5c)
 
int r_jwk_import_from_symmetric_key (jwk_t *jwk, const unsigned char *key, size_t key_len)
 
int r_jwk_import_from_password (jwk_t *jwk, const char *password)
 
int r_jwk_extract_pubkey (jwk_t *jwk_privkey, jwk_t *jwk_pubkey, int x5u_flags)
 
jwk_tr_jwk_quick_import (rhn_import type,...)
 
jwk_tr_jwk_copy (jwk_t *jwk)
 
int r_jwk_equal (jwk_t *jwk1, jwk_t *jwk2)
 
char * r_jwk_export_to_json_str (jwk_t *jwk, int pretty)
 
json_t * r_jwk_export_to_json_t (jwk_t *jwk)
 
gnutls_privkey_t r_jwk_export_to_gnutls_privkey (jwk_t *jwk)
 
gnutls_pubkey_t r_jwk_export_to_gnutls_pubkey (jwk_t *jwk, int x5u_flags)
 
gnutls_x509_crt_t r_jwk_export_to_gnutls_crt (jwk_t *jwk, int x5u_flags)
 
int r_jwk_export_to_pem_der (jwk_t *jwk, int format, unsigned char *output, size_t *output_len, int x5u_flags)
 
int r_jwk_export_to_symmetric_key (jwk_t *jwk, unsigned char *key, size_t *key_len)
 
char * r_jwk_thumbprint (jwk_t *jwk, int hash, int x5u_flags)
 
int r_jwk_validate_x5c_chain (jwk_t *jwk, int x5u_flags)
 
int r_jwk_match_json_t (jwk_t *jwk, json_t *j_match)
 
int r_jwk_match_json_str (jwk_t *jwk, const char *str_match)
 
int r_jwks_is_valid (jwks_t *jwks)
 
int r_jwks_import_from_json_str (jwks_t *jwks, const char *input)
 
int r_jwks_import_from_json_t (jwks_t *jwks, json_t *j_input)
 
int r_jwks_import_from_uri (jwks_t *jwks, const char *uri, int x5u_flags)
 
jwks_tr_jwks_quick_import (rhn_import,...)
 
jwks_tr_jwks_copy (jwks_t *jwks)
 
size_t r_jwks_size (jwks_t *jwks)
 
jwk_tr_jwks_get_at (jwks_t *jwks, size_t index)
 
jwk_tr_jwks_get_by_kid (jwks_t *jwks, const char *kid)
 
int r_jwks_append_jwk (jwks_t *jwks, jwk_t *jwk)
 
int r_jwks_set_at (jwks_t *jwks, size_t index, jwk_t *jwk)
 
int r_jwks_remove_at (jwks_t *jwks, size_t index)
 
int r_jwks_empty (jwks_t *jwks)
 
int r_jwks_equal (jwks_t *jwks1, jwks_t *jwks2)
 
char * r_jwks_export_to_json_str (jwks_t *jwks, int pretty)
 
json_t * r_jwks_export_to_json_t (jwks_t *jwks)
 
gnutls_privkey_t * r_jwks_export_to_gnutls_privkey (jwks_t *jwks, size_t *len)
 
gnutls_pubkey_t * r_jwks_export_to_gnutls_pubkey (jwks_t *jwks, size_t *len, int x5u_flags)
 
int r_jwks_export_to_pem_der (jwks_t *jwks, int format, unsigned char *output, size_t *output_len, int x5u_flags)
 
jwks_tr_jwks_search_json_t (jwks_t *jwks, json_t *j_match)
 
jwks_tr_jwks_search_json_str (jwks_t *jwks, const char *str_match)
 
int r_jws_set_properties (jws_t *jws,...)
 
jws_tr_jws_copy (jws_t *jws)
 
int r_jws_set_payload (jws_t *jws, const unsigned char *payload, size_t payload_len)
 
const unsigned char * r_jws_get_payload (jws_t *jws, size_t *payload_len)
 
int r_jws_set_alg (jws_t *jws, jwa_alg alg)
 
jwa_alg r_jws_get_alg (jws_t *jws)
 
const char * r_jws_get_kid (jws_t *jws)
 
int r_jws_set_header_str_value (jws_t *jws, const char *key, const char *str_value)
 
int r_jws_set_header_int_value (jws_t *jws, const char *key, rhn_int_t i_value)
 
int r_jws_set_header_json_t_value (jws_t *jws, const char *key, json_t *j_value)
 
int r_jws_set_full_header_json_t (jws_t *jws, json_t *j_value)
 
int r_jws_set_full_header_json_str (jws_t *jws, const char *str_value)
 
const char * r_jws_get_header_str_value (jws_t *jws, const char *key)
 
rhn_int_t r_jws_get_header_int_value (jws_t *jws, const char *key)
 
json_t * r_jws_get_header_json_t_value (jws_t *jws, const char *key)
 
json_t * r_jws_get_full_header_json_t (jws_t *jws)
 
char * r_jws_get_full_header_str (jws_t *jws)
 
int r_jws_add_keys (jws_t *jws, jwk_t *jwk_privkey, jwk_t *jwk_pubkey)
 
int r_jws_add_jwks (jws_t *jws, jwks_t *jwks_privkey, jwks_t *jwks_pubkey)
 
int r_jws_add_keys_json_str (jws_t *jws, const char *privkey, const char *pubkey)
 
int r_jws_add_keys_json_t (jws_t *jws, json_t *privkey, json_t *pubkey)
 
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)
 
int r_jws_add_keys_gnutls (jws_t *jws, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey)
 
int r_jws_add_key_symmetric (jws_t *jws, const unsigned char *key, size_t key_len)
 
jwks_tr_jws_get_jwks_privkey (jws_t *jws)
 
jwks_tr_jws_get_jwks_pubkey (jws_t *jws)
 
int r_jws_parse (jws_t *jws, const char *jws_str, int x5u_flags)
 
int r_jws_parsen (jws_t *jws, const char *jws_str, size_t jws_str_len, int x5u_flags)
 
int r_jws_advanced_parse (jws_t *jws, const char *jws_str, uint32_t parse_flags, int x5u_flags)
 
int r_jws_advanced_parsen (jws_t *jws, const char *jws_str, size_t jws_str_len, uint32_t parse_flags, int x5u_flags)
 
int r_jws_parse_unsecure (jws_t *jws, const char *jws_str, int x5u_flags)
 
int r_jws_parsen_unsecure (jws_t *jws, const char *jws_str, size_t jws_str_len, int x5u_flags)
 
int r_jws_compact_parse (jws_t *jws, const char *jws_str, int x5u_flags)
 
int r_jws_advanced_compact_parsen (jws_t *jws, const char *jws_str, size_t jws_str_len, uint32_t parse_flags, int x5u_flags)
 
int r_jws_advanced_compact_parse (jws_t *jws, const char *jws_str, uint32_t parse_flags, int x5u_flags)
 
int r_jws_compact_parsen (jws_t *jws, const char *jws_str, size_t jws_str_len, int x5u_flags)
 
int r_jws_compact_parsen_unsecure (jws_t *jws, const char *jws_str, size_t jws_str_len, int x5u_flags)
 
int r_jws_compact_parse_unsecure (jws_t *jws, const char *jws_str, int x5u_flags)
 
int r_jws_parse_json_str (jws_t *jws, const char *jws_json_str, int x5u_flags)
 
int r_jws_parsen_json_str (jws_t *jws, const char *jws_json_str, size_t jws_json_str_len, int x5u_flags)
 
int r_jws_parse_json_t (jws_t *jws, json_t *jws_json, int x5u_flags)
 
int r_jws_advanced_parse_json_str (jws_t *jws, const char *jws_json_str, uint32_t parse_flags, int x5u_flags)
 
int r_jws_advanced_parsen_json_str (jws_t *jws, const char *jws_json_str, size_t jws_json_str_len, uint32_t parse_flags, int x5u_flags)
 
int r_jws_advanced_parse_json_t (jws_t *jws, json_t *jws_json, uint32_t parse_flags, int x5u_flags)
 
jws_tr_jws_quick_parse (const char *jws_str, uint32_t parse_flags, int x5u_flags)
 
jws_tr_jws_quick_parsen (const char *jws_str, size_t jws_str_len, uint32_t parse_flags, int x5u_flags)
 
int r_jws_verify_signature (jws_t *jws, jwk_t *jwk_pubkey, int x5u_flags)
 
char * r_jws_serialize (jws_t *jws, jwk_t *jwk_privkey, int x5u_flags)
 
char * r_jws_serialize_unsecure (jws_t *jws, jwk_t *jwk_privkey, int x5u_flags)
 
json_t * r_jws_serialize_json_t (jws_t *jws, jwks_t *jwks_privkey, int x5u_flags, int mode)
 
char * r_jws_serialize_json_str (jws_t *jws, jwks_t *jwks_privkey, int x5u_flags, int mode)
 
int r_jwe_set_properties (jwe_t *jwe,...)
 
jwe_tr_jwe_copy (jwe_t *jwe)
 
int r_jwe_set_payload (jwe_t *jwe, const unsigned char *payload, size_t payload_len)
 
const unsigned char * r_jwe_get_payload (jwe_t *jwe, size_t *payload_len)
 
int r_jwe_set_alg (jwe_t *jwe, jwa_alg alg)
 
jwa_alg r_jwe_get_alg (jwe_t *jwe)
 
int r_jwe_set_enc (jwe_t *jwe, jwa_enc enc)
 
jwa_enc r_jwe_get_enc (jwe_t *jwe)
 
const char * r_jwe_get_kid (jwe_t *jwe)
 
int r_jwe_set_header_str_value (jwe_t *jwe, const char *key, const char *str_value)
 
int r_jwe_set_header_int_value (jwe_t *jwe, const char *key, rhn_int_t i_value)
 
int r_jwe_set_header_json_t_value (jwe_t *jwe, const char *key, json_t *j_value)
 
int r_jwe_set_full_header_json_t (jwe_t *jwe, json_t *j_header)
 
int r_jwe_set_full_header_json_str (jwe_t *jwe, const char *str_header)
 
int r_jwe_set_full_unprotected_header_json_t (jwe_t *jwe, json_t *j_unprotected_header)
 
int r_jwe_set_full_unprotected_header_json_str (jwe_t *jwe, const char *str_unprotected_header)
 
json_t * r_jwe_get_full_unprotected_header_json_t (jwe_t *jwe)
 
char * r_jwe_get_full_unprotected_header_str (jwe_t *jwe)
 
const char * r_jwe_get_header_str_value (jwe_t *jwe, const char *key)
 
rhn_int_t r_jwe_get_header_int_value (jwe_t *jwe, const char *key)
 
json_t * r_jwe_get_header_json_t_value (jwe_t *jwe, const char *key)
 
json_t * r_jwe_get_full_header_json_t (jwe_t *jwe)
 
char * r_jwe_get_full_header_str (jwe_t *jwe)
 
int r_jwe_add_keys (jwe_t *jwe, jwk_t *jwk_privkey, jwk_t *jwk_pubkey)
 
int r_jwe_add_jwks (jwe_t *jwe, jwks_t *jwks_privkey, jwks_t *jwks_pubkey)
 
int r_jwe_add_keys_json_str (jwe_t *jwe, const char *privkey, const char *pubkey)
 
int r_jwe_add_keys_json_t (jwe_t *jwe, json_t *privkey, json_t *pubkey)
 
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)
 
int r_jwe_add_keys_gnutls (jwe_t *jwe, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey)
 
int r_jwe_add_key_symmetric (jwe_t *jwe, const unsigned char *key, size_t key_len)
 
jwks_tr_jwe_get_jwks_privkey (jwe_t *jwe)
 
jwks_tr_jwe_get_jwks_pubkey (jwe_t *jwe)
 
int r_jwe_set_cypher_key (jwe_t *jwe, const unsigned char *key, size_t key_len)
 
const unsigned char * r_jwe_get_cypher_key (jwe_t *jwe, size_t *key_len)
 
int r_jwe_generate_cypher_key (jwe_t *jwe)
 
int r_jwe_set_iv (jwe_t *jwe, const unsigned char *iv, size_t iv_len)
 
const unsigned char * r_jwe_get_iv (jwe_t *jwe, size_t *iv_len)
 
int r_jwe_generate_iv (jwe_t *jwe)
 
int r_jwe_set_aad (jwe_t *jwe, const unsigned char *aad, size_t aad_len)
 
const unsigned char * r_jwe_get_aad (jwe_t *jwe, size_t *aad_len)
 
int r_jwe_encrypt_payload (jwe_t *jwe)
 
int r_jwe_decrypt_payload (jwe_t *jwe)
 
int r_jwe_encrypt_key (jwe_t *jwe, jwk_t *jwk_pubkey, int x5u_flags)
 
int r_jwe_decrypt_key (jwe_t *jwe, jwk_t *jwk_privkey, int x5u_flags)
 
int r_jwe_parse (jwe_t *jwe, const char *jwe_str, int x5u_flags)
 
int r_jwe_parsen (jwe_t *jwe, const char *jwe_str, size_t jwe_str_len, int x5u_flags)
 
int r_jwe_advanced_parse (jwe_t *jwe, const char *jwe_str, uint32_t parse_flags, int x5u_flags)
 
int r_jwe_advanced_parsen (jwe_t *jwe, const char *jwe_str, size_t jwe_str_len, uint32_t parse_flags, int x5u_flags)
 
int r_jwe_compact_parse (jwe_t *jwe, const char *jwe_str, int x5u_flags)
 
int r_jwe_compact_parsen (jwe_t *jwe, const char *jwe_str, size_t jwe_str_len, int x5u_flags)
 
int r_jwe_advanced_compact_parse (jwe_t *jwe, const char *jwe_str, uint32_t parse_flags, int x5u_flags)
 
int r_jwe_advanced_compact_parsen (jwe_t *jwe, const char *jwe_str, size_t jwe_str_len, uint32_t parse_flags, int x5u_flags)
 
int r_jwe_parse_json_str (jwe_t *jwe, const char *jwe_json_str, int x5u_flags)
 
int r_jwe_parsen_json_str (jwe_t *jwe, const char *jwe_json_str, size_t jwe_json_str_len, int x5u_flags)
 
int r_jwe_parse_json_t (jwe_t *jwe, json_t *jwe_json, int x5u_flags)
 
int r_jwe_advanced_parse_json_str (jwe_t *jwe, const char *jwe_json_str, uint32_t parse_flags, int x5u_flags)
 
int r_jwe_advanced_parsen_json_str (jwe_t *jwe, const char *jwe_json_str, size_t jwe_json_str_len, uint32_t parse_flags, int x5u_flags)
 
int r_jwe_advanced_parse_json_t (jwe_t *jwe, json_t *jwe_json, uint32_t parse_flags, int x5u_flags)
 
jwe_tr_jwe_quick_parse (const char *jwe_str, uint32_t parse_flags, int x5u_flags)
 
jwe_tr_jwe_quick_parsen (const char *jwe_str, size_t jwe_str_len, uint32_t parse_flags, int x5u_flags)
 
int r_jwe_decrypt (jwe_t *jwe, jwk_t *jwk_privkey, int x5u_flags)
 
char * r_jwe_serialize (jwe_t *jwe, jwk_t *jwk_pubkey, int x5u_flags)
 
char * r_jwe_serialize_json_str (jwe_t *jwe, jwks_t *jwks_pubkey, int x5u_flags, int mode)
 
json_t * r_jwe_serialize_json_t (jwe_t *jwe, jwks_t *jwks_pubkey, int x5u_flags, int mode)
 
int r_jwt_set_properties (jwt_t *jwt,...)
 
jwt_tr_jwt_copy (jwt_t *jwt)
 
int r_jwt_set_header_str_value (jwt_t *jwt, const char *key, const char *str_value)
 
int r_jwt_set_header_int_value (jwt_t *jwt, const char *key, rhn_int_t i_value)
 
int r_jwt_set_header_json_t_value (jwt_t *jwt, const char *key, json_t *j_value)
 
int r_jwt_set_full_header_json_t (jwt_t *jwt, json_t *j_header)
 
int r_jwt_set_full_header_json_str (jwt_t *jwt, const char *str_header)
 
const char * r_jwt_get_header_str_value (jwt_t *jwt, const char *key)
 
rhn_int_t r_jwt_get_header_int_value (jwt_t *jwt, const char *key)
 
json_t * r_jwt_get_header_json_t_value (jwt_t *jwt, const char *key)
 
json_t * r_jwt_get_full_header_json_t (jwt_t *jwt)
 
char * r_jwt_get_full_header_str (jwt_t *jwt)
 
int r_jwt_set_claim_str_value (jwt_t *jwt, const char *key, const char *str_value)
 
int r_jwt_set_claim_int_value (jwt_t *jwt, const char *key, rhn_int_t i_value)
 
int r_jwt_set_claim_json_t_value (jwt_t *jwt, const char *key, json_t *j_value)
 
const char * r_jwt_get_claim_str_value (jwt_t *jwt, const char *key)
 
rhn_int_t r_jwt_get_claim_int_value (jwt_t *jwt, const char *key)
 
json_t * r_jwt_get_claim_json_t_value (jwt_t *jwt, const char *key)
 
json_t * r_jwt_get_full_claims_json_t (jwt_t *jwt)
 
char * r_jwt_get_full_claims_str (jwt_t *jwt)
 
int r_jwt_set_full_claims_json_t (jwt_t *jwt, json_t *j_claim)
 
int r_jwt_set_full_claims_json_str (jwt_t *jwt, const char *str_claims)
 
int r_jwt_append_claims_json_t (jwt_t *jwt, json_t *j_claim)
 
int r_jwt_add_sign_keys (jwt_t *jwt, jwk_t *privkey, jwk_t *pubkey)
 
int r_jwt_add_sign_jwks (jwt_t *jwt, jwks_t *jwks_privkey, jwks_t *jwks_pubkey)
 
int r_jwt_add_sign_keys_json_str (jwt_t *jwt, const char *privkey, const char *pubkey)
 
int r_jwt_add_sign_keys_json_t (jwt_t *jwt, json_t *privkey, json_t *pubkey)
 
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)
 
int r_jwt_add_sign_keys_gnutls (jwt_t *jwt, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey)
 
int r_jwt_add_sign_key_symmetric (jwt_t *jwt, const unsigned char *key, size_t key_len)
 
jwks_tr_jwt_get_sign_jwks_privkey (jwt_t *jwt)
 
jwks_tr_jwt_get_sign_jwks_pubkey (jwt_t *jwt)
 
int r_jwt_add_enc_keys (jwt_t *jwt, jwk_t *privkey, jwk_t *pubkey)
 
int r_jwt_add_enc_jwks (jwt_t *jwt, jwks_t *jwks_privkey, jwks_t *jwks_pubkey)
 
int r_jwt_add_enc_keys_json_str (jwt_t *jwt, const char *privkey, const char *pubkey)
 
int r_jwt_add_enc_keys_json_t (jwt_t *jwt, json_t *privkey, json_t *pubkey)
 
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)
 
int r_jwt_add_enc_keys_gnutls (jwt_t *jwt, gnutls_privkey_t privkey, gnutls_pubkey_t pubkey)
 
int r_jwt_add_enc_key_symmetric (jwt_t *jwt, const unsigned char *key, size_t key_len)
 
jwks_tr_jwt_get_enc_jwks_privkey (jwt_t *jwt)
 
jwks_tr_jwt_get_enc_jwks_pubkey (jwt_t *jwt)
 
int r_jwt_set_sign_alg (jwt_t *jwt, jwa_alg alg)
 
jwa_alg r_jwt_get_sign_alg (jwt_t *jwt)
 
int r_jwt_set_enc_alg (jwt_t *jwt, jwa_alg alg)
 
jwa_alg r_jwt_get_enc_alg (jwt_t *jwt)
 
int r_jwt_set_enc (jwt_t *jwt, jwa_enc enc)
 
jwa_enc r_jwt_get_enc (jwt_t *jwt)
 
const char * r_jwt_get_enc_kid (jwt_t *jwt)
 
const char * r_jwt_get_sig_kid (jwt_t *jwt)
 
int r_jwt_set_enc_cypher_key (jwt_t *jwt, const unsigned char *key, size_t key_len)
 
const unsigned char * r_jwt_get_enc_cypher_key (jwt_t *jwt, size_t *key_len)
 
int r_jwt_generate_enc_cypher_key (jwt_t *jwt)
 
int r_jwt_set_enc_iv (jwt_t *jwt, const unsigned char *iv, size_t iv_len)
 
const unsigned char * r_jwt_get_enc_iv (jwt_t *jwt, size_t *iv_len)
 
int r_jwt_generate_iv (jwt_t *jwt)
 
char * r_jwt_serialize_signed (jwt_t *jwt, jwk_t *privkey, int x5u_flags)
 
char * r_jwt_serialize_signed_unsecure (jwt_t *jwt, jwk_t *privkey, int x5u_flags)
 
char * r_jwt_serialize_encrypted (jwt_t *jwt, jwk_t *pubkey, int x5u_flags)
 
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)
 
int r_jwt_parse (jwt_t *jwt, const char *token, int x5u_flags)
 
int r_jwt_parsen (jwt_t *jwt, const char *token, size_t token_len, int x5u_flags)
 
int r_jwt_parse_unsecure (jwt_t *jwt, const char *token, int x5u_flags)
 
int r_jwt_parsen_unsecure (jwt_t *jwt, const char *token, size_t token_len, int x5u_flags)
 
int r_jwt_advanced_parse (jwt_t *jwt, const char *token, uint32_t parse_flags, int x5u_flags)
 
int r_jwt_advanced_parsen (jwt_t *jwt, const char *token, size_t token_len, uint32_t parse_flags, int x5u_flags)
 
jwt_tr_jwt_quick_parse (const char *token, uint32_t parse_flags, int x5u_flags)
 
jwt_tr_jwt_quick_parsen (const char *token, size_t token_len, uint32_t parse_flags, int x5u_flags)
 
int r_jwt_get_type (jwt_t *jwt)
 
int r_jwt_token_type (const char *token)
 
int r_jwt_token_typen (const char *token, size_t token_len)
 
int r_jwt_verify_signature (jwt_t *jwt, jwk_t *pubkey, int x5u_flags)
 
int r_jwt_decrypt (jwt_t *jwt, jwk_t *privkey, int x5u_flags)
 
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)
 
int r_jwt_decrypt_nested (jwt_t *jwt, jwk_t *decrypt_key, int decrypt_key_x5u_flags)
 
int r_jwt_verify_signature_nested (jwt_t *jwt, jwk_t *verify_key, int verify_key_x5u_flags)
 
int r_jwt_validate_claims (jwt_t *jwt,...)
 
int r_jwt_set_claims (jwt_t *jwt,...)
 
int _r_json_set_str_value (json_t *j_json, const char *key, const char *str_value)
 
int _r_json_set_int_value (json_t *j_json, const char *key, rhn_int_t i_value)
 
int _r_json_set_json_t_value (json_t *j_json, const char *key, json_t *j_value)
 
const char * _r_json_get_str_value (json_t *j_json, const char *key)
 
rhn_int_t _r_json_get_int_value (json_t *j_json, const char *key)
 
json_t * _r_json_get_json_t_value (json_t *j_json, const char *key)
 
json_t * _r_json_get_full_json_t (json_t *j_json)
 
size_t _r_get_key_size (jwa_enc enc)
 
gnutls_cipher_algorithm_t _r_get_alg_from_enc (jwa_enc enc)
 
int _r_deflate_payload (const unsigned char *uncompressed, size_t uncompressed_len, unsigned char **compressed, size_t *compressed_len)
 
int _r_inflate_payload (const unsigned char *compressed, size_t compressed_len, unsigned char **uncompressed, size_t *uncompressed_len)
 

Detailed Description

Rhonabwy JSON Web Key (JWK) library.

rhonabwy.h: structures and functions declarations

Copyright 2020-2022 Nicolas Mora mail@.nosp@m.babe.nosp@m.loues.nosp@m.t.or.nosp@m.g

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU GENERAL PUBLIC LICENSE for more details.

You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses/.

Function Documentation

◆ _r_deflate_payload()

int _r_deflate_payload ( const unsigned char *  uncompressed,
size_t  uncompressed_len,
unsigned char **  compressed,
size_t *  compressed_len 
)

◆ _r_get_alg_from_enc()

gnutls_cipher_algorithm_t _r_get_alg_from_enc ( jwa_enc  enc)

◆ _r_get_key_size()

size_t _r_get_key_size ( jwa_enc  enc)

◆ _r_inflate_payload()

int _r_inflate_payload ( const unsigned char *  compressed,
size_t  compressed_len,
unsigned char **  uncompressed,
size_t *  uncompressed_len 
)

◆ _r_json_get_full_json_t()

json_t * _r_json_get_full_json_t ( json_t *  j_json)

◆ _r_json_get_int_value()

rhn_int_t _r_json_get_int_value ( json_t *  j_json,
const char *  key 
)

◆ _r_json_get_json_t_value()

json_t * _r_json_get_json_t_value ( json_t *  j_json,
const char *  key 
)

◆ _r_json_get_str_value()

const char * _r_json_get_str_value ( json_t *  j_json,
const char *  key 
)

◆ _r_json_set_int_value()

int _r_json_set_int_value ( json_t *  j_json,
const char *  key,
rhn_int_t  i_value 
)

◆ _r_json_set_json_t_value()

int _r_json_set_json_t_value ( json_t *  j_json,
const char *  key,
json_t *  j_value 
)

◆ _r_json_set_str_value()

int _r_json_set_str_value ( json_t *  j_json,
const char *  key,
const char *  str_value 
)

Internal functions