OpenDNSSEC-enforcer 2.1.13
|
#include "config.h"
#include "db/hsm_key.h"
#include "db/policy.h"
#include "db/policy_key.h"
#include "db/key_data.h"
#include "log.h"
#include "scheduler/schedule.h"
#include "scheduler/task.h"
#include "enforcer/enforce_task.h"
#include "daemon/engine.h"
#include "duration.h"
#include "libhsm.h"
#include <math.h>
#include <pthread.h>
#include <ldns/ldns.h>
#include <ldns/util.h>
#include "hsmkey/hsm_key_factory.h"
Go to the source code of this file.
Data Structures | |
struct | __hsm_key_factory_task |
void hsm_key_factory_deinit | ( | void | ) |
Definition at line 84 of file hsm_key_factory.c.
Referenced by engine_dealloc().
int hsm_key_factory_delete_key | ( | const db_connection_t * | connection | ) |
Delete keys that are marked DELETE from the database and the HSM itself,
Definition at line 810 of file hsm_key_factory.c.
References DB_CLAUSE_EQUAL, db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), DB_CLAUSE_OPERATOR_AND, db_clause_set_field(), db_clause_set_operator(), db_clause_set_type(), db_object_delete(), db_value_copy(), db_value_from_text(), hsm_key::dbo, hsm_key_id(), hsm_key_list_free(), hsm_key_list_get_next(), hsm_key_list_new_get_by_clauses(), hsm_key_locator(), hsm_key_state_clause(), HSM_KEY_STATE_DELETE, key_data_count(), key_data_free(), key_data_hsm_key_id_clause(), key_data_new(), and hsm_key::rev.
Referenced by removeDeadKeysNow().
int hsm_key_factory_generate | ( | engine_type * | engine, |
const db_connection_t * | connection, | ||
const policy_t * | policy, | ||
const policy_key_t * | policy_key, | ||
time_t | duration | ||
) |
TODO
Definition at line 94 of file hsm_key_factory.c.
References engineconfig_struct::automatic_keygen_duration, engine_struct::config, db_clause_list_free(), db_clause_list_new(), hsm_key_algorithm_clause(), HSM_KEY_BACKUP_BACKUP_REQUIRED, HSM_KEY_BACKUP_NO_BACKUP, hsm_key_bits_clause(), hsm_key_count(), hsm_key_create(), hsm_key_free(), hsm_key_is_revoked_clause(), hsm_key_key_type_clause(), HSM_KEY_KEY_TYPE_RSA, hsm_key_new(), hsm_key_policy_id_clause(), hsm_key_repository_clause(), hsm_key_role_clause(), hsm_key_set_algorithm(), hsm_key_set_backup(), hsm_key_set_bits(), hsm_key_set_inception(), hsm_key_set_key_type(), hsm_key_set_locator(), hsm_key_set_policy_id(), hsm_key_set_repository(), hsm_key_set_role(), hsm_key_set_state(), hsm_key_state_clause(), HSM_KEY_STATE_UNUSED, policy_key_algorithm(), policy_key_bits(), policy_key_lifetime(), policy_key_policy_id(), policy_key_repository(), policy_key_role_text(), policy_name(), engineconfig_struct::repositories, zone_db_count(), zone_db_free(), zone_db_new(), and zone_db_policy_id_clause().
Referenced by hsm_key_factory_generate_all(), and hsm_key_factory_generate_policy().
int hsm_key_factory_generate_all | ( | engine_type * | engine, |
const db_connection_t * | connection, | ||
time_t | duration | ||
) |
TODO
Definition at line 386 of file hsm_key_factory.c.
References hsm_key_factory_generate(), policy_id(), policy_key_list_free(), policy_key_list_new_get_by_policy_id(), policy_key_list_next(), policy_list_free(), policy_list_new_get(), and policy_list_next().
int hsm_key_factory_generate_policy | ( | engine_type * | engine, |
const db_connection_t * | connection, | ||
const policy_t * | policy, | ||
time_t | duration | ||
) |
TODO
Definition at line 346 of file hsm_key_factory.c.
References hsm_key_factory_generate(), policy_id(), policy_key_list_free(), policy_key_list_new_get_by_policy_id(), policy_key_list_next(), and policy_name().
hsm_key_t * hsm_key_factory_get_key | ( | engine_type * | engine, |
const db_connection_t * | connection, | ||
const policy_key_t * | policy_key, | ||
hsm_key_state_t | hsm_key_state | ||
) |
Allocate a private or shared HSM key for the policy key provided. This will also schedule a task for generating more keys if needed.
[in] | engine | an engine_type. |
[in] | connection | a database connection. |
[in] | policy_key | a policy key. |
[in] | hsm_key_state | indicate if its a private or shared key that should be fetched (HSM_KEY_STATE_PRIVATE | HSM_KEY_STATE_SHARED). |
Definition at line 629 of file hsm_key_factory.c.
References engine_struct::config, db_clause_list_free(), db_clause_list_new(), __hsm_key_factory_task::engine, hsm_key_algorithm_clause(), hsm_key_bits_clause(), hsm_key_free(), hsm_key_is_revoked_clause(), hsm_key_key_type_clause(), HSM_KEY_KEY_TYPE_RSA, hsm_key_list_free(), hsm_key_list_get_next(), hsm_key_list_new_get_by_clauses(), hsm_key_policy_id_clause(), hsm_key_repository_clause(), hsm_key_role_clause(), hsm_key_set_state(), hsm_key_state_clause(), HSM_KEY_STATE_PRIVATE, HSM_KEY_STATE_SHARED, HSM_KEY_STATE_UNUSED, hsm_key_update(), engineconfig_struct::manual_keygen, policy_key_algorithm(), policy_key_bits(), policy_key_policy_id(), and policy_key_repository().
int hsm_key_factory_release_key | ( | hsm_key_t * | hsm_key, |
const db_connection_t * | connection | ||
) |
Release a key, if its not used anyore it will be marked DELETE.
Definition at line 763 of file hsm_key_factory.c.
References db_clause_list_free(), db_clause_list_new(), hsm_key_id(), hsm_key_locator(), hsm_key_set_state(), HSM_KEY_STATE_DELETE, hsm_key_update(), key_data_count(), key_data_free(), key_data_hsm_key_id_clause(), and key_data_new().
int hsm_key_factory_release_key_id | ( | const db_value_t * | hsm_key_id, |
const db_connection_t * | connection | ||
) |
Release a key, if its not used anyore it will be marked DELETE.
[in] | hsm_key_id | a db_value_t pointer with the hsm_key database id. |
Definition at line 704 of file hsm_key_factory.c.
References db_clause_list_free(), db_clause_list_new(), hsm_key_free(), hsm_key_get_by_id(), hsm_key_id(), hsm_key_locator(), hsm_key_new(), hsm_key_set_state(), HSM_KEY_STATE_DELETE, hsm_key_update(), key_data_count(), key_data_free(), key_data_hsm_key_id_clause(), and key_data_new().
Referenced by removeDeadKeysNow(), and zonelist_import().
int hsm_key_factory_schedule_generate_all | ( | engine_type * | engine, |
time_t | duration | ||
) |
Schedule a task to generate keys for all policies and policy keys we currently have.
[in] | engine | an engine_type. |
[in] | duration | a time_t specifying the duration to generate keys from, if its zero then the duration from conf.xml is taken. |
Definition at line 598 of file hsm_key_factory.c.
References __hsm_key_factory_task::duration, __hsm_key_factory_task::engine, __hsm_key_factory_task::policy, __hsm_key_factory_task::policy_key, __hsm_key_factory_task::reschedule_enforce_task, and engine_struct::taskq.
Referenced by autostart(), policy_import(), and zonelist_import().
int hsm_key_factory_schedule_generate_policy | ( | engine_type * | engine, |
const policy_t * | policy_orig, | ||
time_t | duration | ||
) |
Schedule a task to generate keys for a specific policy.
[in] | engine | an engine_type. \prama[in] policy_orig a policy_t pointer to the policy we will generate keys for. |
[in] | duration | a time_t specifying the duration to generate keys from, if its zero then the duration from conf.xml is taken. |
Definition at line 560 of file hsm_key_factory.c.
References __hsm_key_factory_task::duration, __hsm_key_factory_task::engine, __hsm_key_factory_task::policy, policy_free(), __hsm_key_factory_task::policy_key, policy_new_copy(), __hsm_key_factory_task::reschedule_enforce_task, and engine_struct::taskq.