Asterisk - The Open Source Telephony Project
18.5.0
|
Go to the source code of this file.
Macros | |
#define | STIR_SHAKEN_ENCRYPTION_ALGORITHM "ES256" |
#define | STIR_SHAKEN_PPT "shaken" |
#define | STIR_SHAKEN_TYPE "passport" |
Enumerations | |
enum | ast_stir_shaken_verification_result { AST_STIR_SHAKEN_VERIFY_NOT_PRESENT, AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED, AST_STIR_SHAKEN_VERIFY_MISMATCH, AST_STIR_SHAKEN_VERIFY_PASSED } |
Functions | |
int | ast_stir_shaken_add_verification (struct ast_channel *chan, const char *identity, const char *attestation, enum ast_stir_shaken_verification_result result) |
Add a STIR/SHAKEN verification result to a channel. More... | |
unsigned int | ast_stir_shaken_get_signature_timeout (void) |
Retrieve the value for 'signature_timeout' from 'general' config object. More... | |
void | ast_stir_shaken_payload_free (struct ast_stir_shaken_payload *payload) |
Free a STIR/SHAKEN payload. More... | |
char * | ast_stir_shaken_payload_get_public_cert_url (const struct ast_stir_shaken_payload *payload) |
Retrieve the value for 'public_cert_url' from an ast_stir_shaken_payload. More... | |
unsigned char * | ast_stir_shaken_payload_get_signature (const struct ast_stir_shaken_payload *payload) |
Retrieve the value for 'signature' from an ast_stir_shaken_payload. More... | |
struct ast_stir_shaken_payload * | ast_stir_shaken_sign (struct ast_json *json) |
Sign a JSON STIR/SHAKEN payload. More... | |
struct ast_sorcery * | ast_stir_shaken_sorcery (void) |
Retrieve the stir/shaken sorcery context. More... | |
struct ast_stir_shaken_payload * | ast_stir_shaken_verify (const char *header, const char *payload, const char *signature, const char *algorithm, const char *public_cert_url) |
Verify a JSON STIR/SHAKEN payload. More... | |
#define STIR_SHAKEN_ENCRYPTION_ALGORITHM "ES256" |
Definition at line 21 of file res_stir_shaken.h.
Referenced by add_identity_header(), AST_TEST_DEFINE(), and stir_shaken_verify_json().
#define STIR_SHAKEN_PPT "shaken" |
Definition at line 22 of file res_stir_shaken.h.
Referenced by add_identity_header(), AST_TEST_DEFINE(), and stir_shaken_verify_json().
#define STIR_SHAKEN_TYPE "passport" |
Definition at line 23 of file res_stir_shaken.h.
Referenced by AST_TEST_DEFINE(), and stir_shaken_verify_json().
Definition at line 25 of file res_stir_shaken.h.
int ast_stir_shaken_add_verification | ( | struct ast_channel * | chan, |
const char * | identity, | ||
const char * | attestation, | ||
enum ast_stir_shaken_verification_result | result | ||
) |
Add a STIR/SHAKEN verification result to a channel.
chan | The channel |
identity | The identity |
attestation | The attestation |
result | The verification result |
-1 | on failure |
0 | on success |
Definition at line 277 of file res_stir_shaken.c.
References ast_calloc, ast_channel_datastore_add(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_datastore_alloc, ast_log, ast_strdup, stir_shaken_datastore::attestation, ast_datastore::data, stir_shaken_datastore::identity, LOG_ERROR, NULL, result, stir_shaken_datastore_free(), and stir_shaken_datastore::verify_result.
Referenced by stir_shaken_incoming_request().
unsigned int ast_stir_shaken_get_signature_timeout | ( | void | ) |
Retrieve the value for 'signature_timeout' from 'general' config object.
The | signature timeout |
Definition at line 203 of file res_stir_shaken.c.
References ast_stir_shaken_signature_timeout(), and stir_shaken_general_get().
Referenced by compare_timestamp().
void ast_stir_shaken_payload_free | ( | struct ast_stir_shaken_payload * | payload | ) |
Free a STIR/SHAKEN payload.
Definition at line 178 of file res_stir_shaken.c.
References ast_stir_shaken_payload::algorithm, ast_free, ast_json_unref(), ast_stir_shaken_payload::header, ast_stir_shaken_payload::payload, ast_stir_shaken_payload::public_cert_url, and ast_stir_shaken_payload::signature.
Referenced by add_identity_header(), ast_stir_shaken_sign(), ast_stir_shaken_verify(), AST_TEST_DEFINE(), stir_shaken_incoming_request(), and stir_shaken_verify_json().
char* ast_stir_shaken_payload_get_public_cert_url | ( | const struct ast_stir_shaken_payload * | payload | ) |
Retrieve the value for 'public_cert_url' from an ast_stir_shaken_payload.
payload | The payload |
The | public key URL |
Definition at line 198 of file res_stir_shaken.c.
References NULL, and ast_stir_shaken_payload::public_cert_url.
Referenced by add_identity_header().
unsigned char* ast_stir_shaken_payload_get_signature | ( | const struct ast_stir_shaken_payload * | payload | ) |
Retrieve the value for 'signature' from an ast_stir_shaken_payload.
payload | The payload |
The | signature |
Definition at line 193 of file res_stir_shaken.c.
References NULL, and ast_stir_shaken_payload::signature.
Referenced by add_identity_header().
struct ast_stir_shaken_payload* ast_stir_shaken_sign | ( | struct ast_json * | json | ) |
Sign a JSON STIR/SHAKEN payload.
json | The JWT to sign |
ast_stir_shaken_payload | on success |
NULL | on failure |
Definition at line 1046 of file res_stir_shaken.c.
References ao2_cleanup, ast_calloc, ast_free, ast_json_dump_string, ast_json_object_get(), ast_json_string_get(), ast_log, ast_stir_shaken_payload_free(), ast_strdup, cleanup(), ast_stir_shaken_payload::header, LOG_ERROR, NULL, ast_stir_shaken_payload::payload, ast_stir_shaken_payload::public_cert_url, ast_stir_shaken_payload::signature, stir_shaken_add_attest(), stir_shaken_add_iat(), stir_shaken_add_origid(), stir_shaken_add_x5u(), stir_shaken_certificate_get_attestation(), stir_shaken_certificate_get_by_caller_id_number(), stir_shaken_certificate_get_private_key(), stir_shaken_certificate_get_public_cert_url(), stir_shaken_sign(), and stir_shaken_verify_json().
Referenced by add_identity_header(), and AST_TEST_DEFINE().
struct ast_sorcery* ast_stir_shaken_sorcery | ( | void | ) |
Retrieve the stir/shaken sorcery context.
The | stir/shaken sorcery context |
Definition at line 173 of file res_stir_shaken.c.
References stir_shaken_sorcery.
Referenced by load_module(), stir_shaken_certificate_get(), stir_shaken_certificate_get_all(), stir_shaken_certificate_get_by_caller_id_number(), stir_shaken_certificate_load(), stir_shaken_cli_show(), stir_shaken_general_get(), stir_shaken_general_load(), stir_shaken_general_unload(), stir_shaken_store_get(), stir_shaken_store_get_all(), stir_shaken_store_load(), test_stir_shaken_cleanup_cert(), and test_stir_shaken_create_cert().
struct ast_stir_shaken_payload* ast_stir_shaken_verify | ( | const char * | header, |
const char * | payload, | ||
const char * | signature, | ||
const char * | algorithm, | ||
const char * | public_cert_url | ||
) |
Verify a JSON STIR/SHAKEN payload.
header | The payload header |
payload | The payload section |
signature | The payload signature |
algorithm | The signature algorithm |
public_cert_url | The public key URL |
ast_stir_shaken_payload | on success |
NULL | on failure |
Definition at line 620 of file res_stir_shaken.c.
References add_public_key_to_astdb(), ast_stir_shaken_payload::algorithm, ast_asprintf, ast_calloc, ast_config_AST_DATA_DIR, ast_debug, ast_free, ast_json_load_string(), ast_log, ast_stir_shaken_payload_free(), ast_strdup, ast_strlen_zero, curl_and_check_expiration(), get_path_to_public_key(), ast_stir_shaken_payload::header, LOG_ERROR, NULL, ast_stir_shaken_payload::payload, ast_stir_shaken_payload::public_cert_url, public_key_is_expired(), RAII_VAR, remove_public_key_from_astdb(), run_curl(), ast_stir_shaken_payload::signature, STIR_SHAKEN_DIR_NAME, stir_shaken_read_key(), and stir_shaken_verify_signature().
Referenced by AST_TEST_DEFINE(), and stir_shaken_incoming_request().