![]() |
wget2
1.0.0
|
Functions | |
void | wget_hpkp_pin_add (wget_hpkp_t *hpkp, const char *pin_type, const char *pin_b64) |
void | wget_hpkp_free (wget_hpkp_t *hpkp) |
wget_hpkp_t * | wget_hpkp_new (void) |
void | wget_hpkp_set_host (wget_hpkp_t *hpkp, const char *host) |
void | wget_hpkp_set_maxage (wget_hpkp_t *hpkp, long maxage) |
void | wget_hpkp_set_include_subdomains (wget_hpkp_t *hpkp, int include_subdomains) |
wget_hpkp_db_t * | wget_hpkp_db_init (wget_hpkp_db_t *hpkp_db) |
void | wget_hpkp_db_deinit (wget_hpkp_db_t *hpkp_db) |
void | wget_hpkp_db_free (wget_hpkp_db_t **hpkp_db) |
int | wget_hpkp_db_check_pubkey (wget_hpkp_db_t *hpkp_db, const char *host, const void *pubkey, size_t pubkeysize) |
void | wget_hpkp_db_add (wget_hpkp_db_t *hpkp_db, wget_hpkp_t **_hpkp) |
int | wget_hpkp_db_load (wget_hpkp_db_t *hpkp_db, const char *fname) |
int | wget_hpkp_db_save (wget_hpkp_db_t *hpkp_db, const char *fname) |
This is an implementation of RFC 7469.
wget_hpkp_t* wget_hpkp_new | ( | void | ) |
[in] | host | Host name the following information refers to |
[in] | port | Port number the following information refers to |
[in] | max_age | Value of the max-age field |
[in] | include_subdomains | Value of the includeSubDomains field |
Creates a new HPKP structure initialized with the given values.
wget_hpkp_db_t* wget_hpkp_db_init | ( | wget_hpkp_db_t * | hpkp_db | ) |
Initializes a new HPKP database.
void wget_hpkp_db_free | ( | wget_hpkp_db_t ** | hpkp_db | ) |
[in] | hpkp_db | Pointer to the pointer of an HPKP database, provided by wget_hpkp_db_init() |
Closes and frees the HPKP database. A double pointer is required because this function will set the handle (pointer) to the HPKP database to NULL to prevent potential use-after-free conditions.
int wget_hpkp_db_save | ( | wget_hpkp_db_t * | hpkp_db, |
const char * | fname | ||
) |
[in] | hpkp_db | Handle to an HPKP database, obtained with wget_hpkp_db_init() |
[in] | fname | Path to a file |
Saves the current HPKP database to the specified file.
The information will be stored in a human-readable format for inspection, but it is discouraged to rely on it for external processing. In particular, no application other than wget2 should modify the contents of the file as the format might change between releases without notice.
This function returns the number of SPKIs written to the file, which is effectively equal to the number of SPKIs in the database when this function was called, and thus, might be zero. If the file specified by filename
exists, all its contents will be overwritten with the current contents of the database. Otherwise, if the file exists but there are no SPKIs in the database, the file will be deleted to avoid leaving an empty file.
If the file cannot be opened for writing WGET_HPKP_ERROR_FILE_OPEN
is returned, and WGET_HPKP_ERROR
in any other case.