Rhonabwy
Javascript Object Signing and Encryption (JOSE) library - JWK, JWKS, JWS, JWE and JWT
|
Functions | |
int | r_jws_set_properties (jws_t *jws,...) |
jws_t * | r_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_t * | r_jws_get_jwks_privkey (jws_t *jws) |
jwks_t * | r_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_t * | r_jws_quick_parse (const char *jws_str, uint32_t parse_flags, int x5u_flags) |
jws_t * | r_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) |
Manage JSON Web Signatures
Adds private and/or public keys sets for the signature and verification
jws | the jws_t to update |
jwks_privkey | the private key set in jwk_t * format, can be NULL |
jwks_pubkey | the public key set in jwk_t * format, can be NULL |
int r_jws_add_key_symmetric | ( | jws_t * | jws, |
const unsigned char * | key, | ||
size_t | key_len | ||
) |
Add symmetric key by value to perform signature or signature verification
jws | the jws_t to update |
key | the raw key value |
key_len | the length of the key |
Sets the private and public keys for the signature and verification
jws | the jws_t to update |
jwk_privkey | the private key in jwk_t * format, can be NULL |
jwk_pubkey | the public key in jwk_t * format, can be NULL |
int r_jws_add_keys_gnutls | ( | jws_t * | jws, |
gnutls_privkey_t | privkey, | ||
gnutls_pubkey_t | pubkey | ||
) |
Add keys to perform signature or signature verification keys must be gnutls key structures
jws | the jws_t to update |
privkey | the private key to sign the |
pubkey | the public key to verify the signature |
int r_jws_add_keys_json_str | ( | jws_t * | jws, |
const char * | privkey, | ||
const char * | pubkey | ||
) |
Add keys to perform signature or signature verification keys must be a JWK stringified
jws | the jws_t to update |
privkey | the private key to sign |
pubkey | the public key to verify the signature |
int r_jws_add_keys_json_t | ( | jws_t * | jws, |
json_t * | privkey, | ||
json_t * | pubkey | ||
) |
Add keys to perform signature or signature verification keys must be a JWK in json_t * format
jws | the jws_t to update |
privkey | the private key to sign the |
pubkey | the public key to verify the signature |
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 | ||
) |
Add keys to perform signature or signature verification keys must be in PEM or DER format
jws | the jws_t to update |
format | the format of the input, values available are R_FORMAT_PEM or R_FORMAT_DER |
privkey | the private key to sign the |
privkey_len | length of privkey |
pubkey | the public key to verify the signature |
pubkey_len | length of pubkey |
int r_jws_advanced_compact_parse | ( | jws_t * | jws, |
const char * | jws_str, | ||
uint32_t | parse_flags, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in compact mode (xxx.yyy.zzz)
jws | the jws_t to update |
jws_str | the serialized JWS to parse, must end with a NULL string terminator |
parse_flags | Flags to set or unset options Flags available are
|
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
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 | ||
) |
Parses the serialized JWS in compact mode (xxx.yyy.zzz)
jws | the jws_t to update |
jws_str | the serialized JWS to parse |
jws_str_len | the length of jws_str to parse |
parse_flags | Flags to set or unset options Flags available are
|
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_advanced_parse | ( | jws_t * | jws, |
const char * | jws_str, | ||
uint32_t | parse_flags, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in all modes (compact, flattened or general)
jws | the jws_t to update |
jws_str | the serialized JWS to parse, must end with a NULL string terminator |
parse_flags | Flags to set or unset options Flags available are
|
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_advanced_parse_json_str | ( | jws_t * | jws, |
const char * | jws_json_str, | ||
uint32_t | parse_flags, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in JSON mode, general or flattened
jws | the jws_t to update |
jws_json_str | the serialized JWS to parse in char * format |
parse_flags | Flags to set or unset options Flags available are
|
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_advanced_parse_json_t | ( | jws_t * | jws, |
json_t * | jws_json, | ||
uint32_t | parse_flags, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in JSON mode, general or flattened
jws | the jws_t to update |
jws_json | the serialized JWS to parse in json_t * format |
parse_flags | Flags to set or unset options Flags available are
|
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_advanced_parsen | ( | jws_t * | jws, |
const char * | jws_str, | ||
size_t | jws_str_len, | ||
uint32_t | parse_flags, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in all modes (compact, flattened or general)
jws | the jws_t to update |
jws_str | the serialized JWS to parse |
jws_str_len | the length of jws_str to parse |
parse_flags | Flags to set or unset options Flags available are
|
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
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 | ||
) |
Parses the serialized JWS in JSON mode, general or flattened
jws | the jws_t to update |
jws_json_str | the serialized JWS to parse in char * format |
jws_json_str_len | the length of jws_str to parse |
parse_flags | Flags to set or unset options Flags available are
|
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_compact_parse | ( | jws_t * | jws, |
const char * | jws_str, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in compact mode (xxx.yyy.zzz)
jws | the jws_t to update |
jws_str | the serialized JWS to parse, must end with a NULL string terminator |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_compact_parse_unsecure | ( | jws_t * | jws, |
const char * | jws_str, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in compact mode (xxx.yyy.zzz) Allows to parse unsigned JWS
jws | the jws_t to update |
jws_str | the serialized JWS to parse, must end with a NULL string terminator |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_compact_parsen | ( | jws_t * | jws, |
const char * | jws_str, | ||
size_t | jws_str_len, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in compact mode (xxx.yyy.zzz)
jws | the jws_t to update |
jws_str | the serialized JWS to parse |
jws_str_len | the length of jws_str to parse |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_compact_parsen_unsecure | ( | jws_t * | jws, |
const char * | jws_str, | ||
size_t | jws_str_len, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in compact mode (xxx.yyy.zzz) Allows to parse unsigned JWS
jws | the jws_t to update |
jws_str | the serialized JWS to parse |
jws_str_len | the length of jws_str to parse |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
json_t * r_jws_get_full_header_json_t | ( | jws_t * | jws | ) |
Return the full JWS header in JSON format
jws | the jws_t to get the value |
char * r_jws_get_full_header_str | ( | jws_t * | jws | ) |
Return the full JWS header in char *
jws | the jws_t to get the value |
Gets an integer value from the JWS header
jws | the jws_t to get the value |
key | the key to retreive the value |
json_t * r_jws_get_header_json_t_value | ( | jws_t * | jws, |
const char * | key | ||
) |
Gets a JSON value from the JWS header
jws | the jws_t to get the value |
key | the key to retreive the value |
const char * r_jws_get_header_str_value | ( | jws_t * | jws, |
const char * | key | ||
) |
Gets a string value from the JWS header
jws | the jws_t to get the value |
key | the key to retreive the value |
Get private keys set for the signature
jws | the jws_t to get the value |
Get public keys set for the verification
jws | the jws_t to get the value |
const char * r_jws_get_kid | ( | jws_t * | jws | ) |
Get the KID specified in the header used for signature
jws | the jws_t to update |
const unsigned char * r_jws_get_payload | ( | jws_t * | jws, |
size_t * | payload_len | ||
) |
Get the JWS payload
jws | the jws_t to get the payload from |
payload_len | the length of the JWS payload, may be NULL |
int r_jws_parse | ( | jws_t * | jws, |
const char * | jws_str, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in all modes (compact, flattened or general)
jws | the jws_t to update |
jws_str | the serialized JWS to parse, must end with a NULL string terminator |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_parse_json_str | ( | jws_t * | jws, |
const char * | jws_json_str, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in JSON mode, general or flattened
jws | the jws_t to update |
jws_json_str | the serialized JWS to parse in char * format |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_parse_json_t | ( | jws_t * | jws, |
json_t * | jws_json, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in JSON mode, general or flattened
jws | the jws_t to update |
jws_json | the serialized JWS to parse in json_t * format |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_parse_unsecure | ( | jws_t * | jws, |
const char * | jws_str, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in all modes (compact, flattened or general) Allows to parse unsigned JWS
jws | the jws_t to update |
jws_str | the serialized JWS to parse, must end with a NULL string terminator |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_parsen | ( | jws_t * | jws, |
const char * | jws_str, | ||
size_t | jws_str_len, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in all modes (compact, flattened or general)
jws | the jws_t to update |
jws_str | the serialized JWS to parse |
jws_str_len | the length of jws_str to parse |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_parsen_json_str | ( | jws_t * | jws, |
const char * | jws_json_str, | ||
size_t | jws_json_str_len, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in JSON mode, general or flattened
jws | the jws_t to update |
jws_json_str | the serialized JWS to parse in char * format |
jws_json_str_len | the length of jws_str to parse |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
int r_jws_parsen_unsecure | ( | jws_t * | jws, |
const char * | jws_str, | ||
size_t | jws_str_len, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in all modes (compact, flattened or general) Allows to parse unsigned JWS
jws | the jws_t to update |
jws_str | the serialized JWS to parse |
jws_str_len | the length of jws_str to parse |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
jws_t * r_jws_quick_parse | ( | const char * | jws_str, |
uint32_t | parse_flags, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in all modes (compact, flattened or general)
jws_str | the serialized JWS to parse in char * format |
parse_flags | Flags to set or unset options Flags available are
|
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
jws_t * r_jws_quick_parsen | ( | const char * | jws_str, |
size_t | jws_str_len, | ||
uint32_t | parse_flags, | ||
int | x5u_flags | ||
) |
Parses the serialized JWS in all modes (compact, flattened or general)
jws_str | the serialized JWS to parse in char * format |
jws_str_len | the length of jws_str |
parse_flags | Flags to set or unset options Flags available are
|
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
Serialize a JWS in compact mode (xxx.yyy.zzz)
jws | the JWS to serialize |
jwk_privkey | the private key to use to sign the JWS can be NULL if jws already contains a private key |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
Serialize a JWS into its JSON format (general or flattened) Mode general: Multiple signatures are generated. You can use the jws prikeys or specify the private keys Every jwk used to sign the jws must have a property 'alg' to specify the signing algorithm It is recommended, but not mandatory, to use JWKs with kid property
jws | the JWS to serialize |
jwks_privkey | the private keys to use to sign the JWS can be NULL if jws already contains a private key set |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
mode | JSON serialization mode Values available are
|
Serialize a JWS into its JSON format (general or flattened) Mode general: Multiple signatures are generated. You can use the jws prikeys or specify the private keys Every jwk used to sign the jws must have a property 'alg' to specify the signing algorithm It is recommended, but not mandatory, to use JWKs with kid property
jws | the JWS to serialize |
jwks_privkey | the private keys to use to sign the JWS can be NULL if jws already contains a private key set |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
mode | JSON serialization mode Values available are
|
Serialize a JWS in compact mode (xxx.yyy.zzz) Allows to serialize unsigned JWS
jws | the JWS to serialize |
jwk_privkey | the private key to use to sign the JWS can be NULL if jws already contains a private key |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|
Set the JWS alg to use for signature
jws | the jws_t to update |
alg | the algorithm to use |
int r_jws_set_full_header_json_str | ( | jws_t * | jws, |
const char * | str_value | ||
) |
Sets the entire header with the stringified JSON value specified
jws | the jws_t to update |
str_value | the header to set, must be a stringified JSON object |
int r_jws_set_full_header_json_t | ( | jws_t * | jws, |
json_t * | j_value | ||
) |
Sets the entire header with the JSON value specified
jws | the jws_t to update |
j_value | the header to set, must be a JSON object |
Adds an integer value to the JWS header
jws | the jws_t to update |
key | the key to set to the JWS header |
i_value | the value to set |
int r_jws_set_header_json_t_value | ( | jws_t * | jws, |
const char * | key, | ||
json_t * | j_value | ||
) |
Adds a JSON value to the JWS header
jws | the jws_t to update |
key | the key to set to the JWS header |
j_value | the value to set |
int r_jws_set_header_str_value | ( | jws_t * | jws, |
const char * | key, | ||
const char * | str_value | ||
) |
Adds a string value to the JWS header
jws | the jws_t to update |
key | the key to set to the JWS header |
str_value | the value to set |
int r_jws_set_payload | ( | jws_t * | jws, |
const unsigned char * | payload, | ||
size_t | payload_len | ||
) |
Set the payload of the jws
jws | the jws_t to update |
payload | the payload to set |
payload_len | the size of the payload |
int r_jws_set_properties | ( | jws_t * | jws, |
... | |||
) |
Verifies the signature of the JWS The JWS must contain a signature If the jws has multiple signatures, it will return RHN_OK if one signature matches the public key
jws | the jws_t to update |
jwk_pubkey | the public key to check the signature, can be NULL if jws already contains a public key |
x5u_flags | Flags to retrieve x5u certificates pointed by x5u if necessary, could be 0 if not needed Flags available are
|