Rhonabwy: Core functions

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

Functions
Core functions

## Functions
int | r_global_init ()
void | r_global_close ()
json_t * | r_library_info_json_t ()
char * | r_library_info_json_str ()
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)

## Detailed Description

Core functions used to initialize or free jwk_t and check if a jwk is valid and its type

## Function Documentation

## ◆ r_global_init()

int r_global_init | ( |  | ) |

Initialize rhonabwy global parameters This function isn't thread-safe so it must be called once before any other call to rhonabwy functions The function r_global_close must be called when rhonabwy library is no longer required

Returns
  RHN_OK on success, an error value on error

## ◆ r_global_close()

void r_global_close | ( |  | ) |

Close rhonabwy global parameters

## ◆ r_library_info_json_t()

json_t* r_library_info_json_t | ( |  | ) |

Get the library information as a json_t * object

- library version
- supported JWS algorithms
- supported JWE algorithms
  Returns
    the library information

## ◆ r_library_info_json_str()

char* r_library_info_json_str | ( |  | ) |

Get the library information as a JSON object in string format

- library version
- supported JWS algorithms
- supported JWE algorithms
  Returns
    the library information, must be r_free'd after use

## ◆ r_free()

void r_free | ( | void * | data | ) |

Free a heap allocated variable previously returned by a rhonabwy function

Parameters

  data | the data to free

## ◆ r_jwk_init()

int r_jwk_init | ( | jwk_t ** | jwk | ) |

Initialize a jwk_t

Parameters

  jwk | a reference to a jwk_t * to initialize

Returns
  RHN_OK on success, an error value on error

## ◆ r_jwk_free()

void r_jwk_free | ( | jwk_t * | jwk | ) |

Free a jwk_t

Parameters

  jwk | the jwk_t * to free

## ◆ r_jwks_init()

int r_jwks_init | ( | jwks_t ** | jwks | ) |

Initialize a jwks_t

Parameters

  jwks | a reference to a jwks_t * to initialize

Returns
  RHN_OK on success, an error value on error

## ◆ r_jwks_free()

void r_jwks_free | ( | jwks_t * | jwks | ) |

Free a jwks_t

Parameters

  jwks | the jwks_t * to free

## ◆ r_jws_init()

int r_jws_init | ( | jws_t ** | jws | ) |

Initialize a jws_t

Parameters

  jws | a reference to a jws_t * to initialize

Returns
  RHN_OK on success, an error value on error

## ◆ r_jws_free()

void r_jws_free | ( | jws_t * | jws | ) |

Free a jws_t

Parameters

  jws | the jws_t * to free

## ◆ r_jwe_init()

int r_jwe_init | ( | jwe_t ** | jwe | ) |

Initialize a jwe_t

Parameters

  jwe | a reference to a jwe_t * to initialize

Returns
  RHN_OK on success, an error value on error

## ◆ r_jwe_free()

void r_jwe_free | ( | jwe_t * | jwe | ) |

Free a jwe_t

Parameters

  jwe | the jwe_t * to free

## ◆ r_jwt_init()

int r_jwt_init | ( | jwt_t ** | jwt | ) |

Initialize a jwt_t

Parameters

  jwt | a reference to a jwt_t * to initialize

Returns
  RHN_OK on success, an error value on error

Rhonabwy JSON Web Token (JWT) library

jwt.c: functions definitions

Copyright 2020-2021 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/.

## ◆ r_jwt_free()

void r_jwt_free | ( | jwt_t * | jwt | ) |

Free a jwt_t

Parameters

  jwt | the jwt_t * to free

## ◆ r_str_to_jwa_alg()

jwa_alg r_str_to_jwa_alg | ( | const char * | alg | ) |

Get the jwa_alg corresponding to the string algorithm specified

Parameters

  alg | the algorithm to convert

Returns
  the converted jwa_alg, R_JWA_ALG_NONE if alg is unknown

## ◆ r_jwa_alg_to_str()

const char* r_jwa_alg_to_str | ( | jwa_alg | alg | ) |

Get the algorithm string corresponding to the jwa_alg

Parameters

  alg | the algorithm to convert

Returns
  its string name

## ◆ r_str_to_jwa_enc()

jwa_enc r_str_to_jwa_enc | ( | const char * | enc | ) |

Get the jwa_enc corresponding to the string algorithm specified

Parameters

  enc | the algorithm to convert

Returns
  the converted jwa_enc, R_JWA_ENC_NONE if enc is unknown

## ◆ r_jwa_enc_to_str()

const char* r_jwa_enc_to_str | ( | jwa_enc | enc | ) |

Get the encryption string corresponding to the jwa_enc

Parameters

  enc | the encryption to convert

Returns
  its string name