Rhonabwy
Javascript Object Signing and Encryption (JOSE) library - JWK, JWKS, JWS, JWE and JWT
Macros | Functions
jwk.c File Reference
#include <string.h>
#include <gnutls/abstract.h>
#include <gnutls/x509.h>
#include <gnutls/crypto.h>
#include <orcania.h>
#include <yder.h>
#include <rhonabwy.h>

Macros

#define RHN_PEM_HEADER_CERT   "-----BEGIN CERTIFICATE-----"
 
#define RHN_PEM_HEADER_PUBKEY   "-----BEGIN PUBLIC KEY-----"
 
#define RHN_PEM_HEADER_PRIVKEY   "-----BEGIN PRIVATE KEY-----"
 
#define RHN_PEM_HEADER_EC_PRIVKEY   "-----BEGIN EC PRIVATE KEY-----"
 
#define RHN_PEM_HEADER_RSA_PRIVKEY   "-----BEGIN RSA PRIVATE KEY-----"
 
#define RHN_PEM_HEADER_UNKNOWN_PRIVKEY   "-----BEGIN UNKNOWN-----"
 

Functions

int _r_get_http_content (const char *url, int x5u_flags, const char *expected_content_type, struct _o_datum *datum)
 
int r_jwk_init (jwk_t **jwk)
 
void r_jwk_free (jwk_t *jwk)
 
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)
 
int r_jwk_key_type (jwk_t *jwk, unsigned int *bits, int x5u_flags)
 
int r_jwk_extract_pubkey (jwk_t *jwk_privkey, jwk_t *jwk_pubkey, int x5u_flags)
 
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)
 
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)
 
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)
 
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)
 

Macro Definition Documentation

◆ RHN_PEM_HEADER_CERT

#define RHN_PEM_HEADER_CERT   "-----BEGIN CERTIFICATE-----"

Rhonabwy JSON Web Key (JWK) library

jwk.c: functions definitions

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/.

◆ RHN_PEM_HEADER_EC_PRIVKEY

#define RHN_PEM_HEADER_EC_PRIVKEY   "-----BEGIN EC PRIVATE KEY-----"

◆ RHN_PEM_HEADER_PRIVKEY

#define RHN_PEM_HEADER_PRIVKEY   "-----BEGIN PRIVATE KEY-----"

◆ RHN_PEM_HEADER_PUBKEY

#define RHN_PEM_HEADER_PUBKEY   "-----BEGIN PUBLIC KEY-----"

◆ RHN_PEM_HEADER_RSA_PRIVKEY

#define RHN_PEM_HEADER_RSA_PRIVKEY   "-----BEGIN RSA PRIVATE KEY-----"

◆ RHN_PEM_HEADER_UNKNOWN_PRIVKEY

#define RHN_PEM_HEADER_UNKNOWN_PRIVKEY   "-----BEGIN UNKNOWN-----"

Function Documentation

◆ _r_get_http_content()

int _r_get_http_content ( const char *  url,
int  x5u_flags,
const char *  expected_content_type,
struct _o_datum *  datum 
)