OpenDNSSEC-enforcer 2.1.12
Functions | Variables
hsm_key.c File Reference
#include "hsm_key.h"
#include "db_error.h"
#include <string.h>

Go to the source code of this file.

Functions

hsm_key_thsm_key_new (const db_connection_t *connection)
 
hsm_key_thsm_key_new_copy (const hsm_key_t *hsm_key)
 
void hsm_key_free (hsm_key_t *hsm_key)
 
int hsm_key_copy (hsm_key_t *hsm_key, const hsm_key_t *hsm_key_copy)
 
int hsm_key_from_result (hsm_key_t *hsm_key, const db_result_t *result)
 
const db_value_thsm_key_id (const hsm_key_t *hsm_key)
 
const db_value_thsm_key_policy_id (const hsm_key_t *hsm_key)
 
const char * hsm_key_locator (const hsm_key_t *hsm_key)
 
hsm_key_state_t hsm_key_state (const hsm_key_t *hsm_key)
 
unsigned int hsm_key_bits (const hsm_key_t *hsm_key)
 
unsigned int hsm_key_algorithm (const hsm_key_t *hsm_key)
 
hsm_key_role_t hsm_key_role (const hsm_key_t *hsm_key)
 
unsigned int hsm_key_inception (const hsm_key_t *hsm_key)
 
const char * hsm_key_repository (const hsm_key_t *hsm_key)
 
hsm_key_backup_t hsm_key_backup (const hsm_key_t *hsm_key)
 
int hsm_key_set_policy_id (hsm_key_t *hsm_key, const db_value_t *policy_id)
 
int hsm_key_set_locator (hsm_key_t *hsm_key, const char *locator_text)
 
int hsm_key_set_state (hsm_key_t *hsm_key, hsm_key_state_t state)
 
int hsm_key_set_bits (hsm_key_t *hsm_key, unsigned int bits)
 
int hsm_key_set_algorithm (hsm_key_t *hsm_key, unsigned int algorithm)
 
int hsm_key_set_role (hsm_key_t *hsm_key, hsm_key_role_t role)
 
int hsm_key_set_inception (hsm_key_t *hsm_key, unsigned int inception)
 
int hsm_key_set_key_type (hsm_key_t *hsm_key, hsm_key_key_type_t key_type)
 
int hsm_key_set_repository (hsm_key_t *hsm_key, const char *repository_text)
 
int hsm_key_set_backup (hsm_key_t *hsm_key, hsm_key_backup_t backup)
 
db_clause_thsm_key_policy_id_clause (db_clause_list_t *clause_list, const db_value_t *policy_id)
 
db_clause_thsm_key_state_clause (db_clause_list_t *clause_list, hsm_key_state_t state)
 
db_clause_thsm_key_bits_clause (db_clause_list_t *clause_list, unsigned int bits)
 
db_clause_thsm_key_algorithm_clause (db_clause_list_t *clause_list, unsigned int algorithm)
 
db_clause_thsm_key_role_clause (db_clause_list_t *clause_list, hsm_key_role_t role)
 
db_clause_thsm_key_is_revoked_clause (db_clause_list_t *clause_list, unsigned int is_revoked)
 
db_clause_thsm_key_key_type_clause (db_clause_list_t *clause_list, hsm_key_key_type_t key_type)
 
db_clause_thsm_key_repository_clause (db_clause_list_t *clause_list, const char *repository_text)
 
db_clause_thsm_key_backup_clause (db_clause_list_t *clause_list, hsm_key_backup_t backup)
 
int hsm_key_create (hsm_key_t *hsm_key)
 
int hsm_key_get_by_id (hsm_key_t *hsm_key, const db_value_t *id)
 
int hsm_key_get_by_locator (hsm_key_t *hsm_key, const char *locator)
 
hsm_key_thsm_key_new_get_by_locator (const db_connection_t *connection, const char *locator)
 
int hsm_key_update (hsm_key_t *hsm_key)
 
int hsm_key_count (hsm_key_t *hsm_key, db_clause_list_t *clause_list, size_t *count)
 
hsm_key_list_thsm_key_list_new (const db_connection_t *connection)
 
hsm_key_list_thsm_key_list_new_copy (const hsm_key_list_t *from_hsm_key_list)
 
int hsm_key_list_object_store (hsm_key_list_t *hsm_key_list)
 
void hsm_key_list_free (hsm_key_list_t *hsm_key_list)
 
int hsm_key_list_copy (hsm_key_list_t *hsm_key_list, const hsm_key_list_t *from_hsm_key_list)
 
int hsm_key_list_get_by_clauses (hsm_key_list_t *hsm_key_list, const db_clause_list_t *clause_list)
 
hsm_key_list_thsm_key_list_new_get_by_clauses (const db_connection_t *connection, const db_clause_list_t *clause_list)
 
int hsm_key_list_get_by_policy_id (hsm_key_list_t *hsm_key_list, const db_value_t *policy_id)
 
hsm_key_list_thsm_key_list_new_get_by_policy_id (const db_connection_t *connection, const db_value_t *policy_id)
 
const hsm_key_thsm_key_list_begin (hsm_key_list_t *hsm_key_list)
 
hsm_key_thsm_key_list_get_begin (hsm_key_list_t *hsm_key_list)
 
const hsm_key_thsm_key_list_next (hsm_key_list_t *hsm_key_list)
 
hsm_key_thsm_key_list_get_next (hsm_key_list_t *hsm_key_list)
 

Variables

const db_enum_t hsm_key_enum_set_state []
 
const db_enum_t hsm_key_enum_set_role []
 
const db_enum_t hsm_key_enum_set_key_type []
 
const db_enum_t hsm_key_enum_set_backup []
 

Function Documentation

◆ hsm_key_algorithm()

unsigned int hsm_key_algorithm ( const hsm_key_t hsm_key)

Get the algorithm of a hsm key object. Undefined behavior if hsm_key is NULL.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
an unsigned integer.

Definition at line 544 of file hsm_key.c.

References hsm_key::algorithm.

◆ hsm_key_algorithm_clause()

db_clause_t * hsm_key_algorithm_clause ( db_clause_list_t clause_list,
unsigned int  algorithm 
)

Create a clause for algorithm of a hsm key object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters
[in]clause_listdb_clause_list_t pointer.
[in]algorithman unsigned integer.
Returns
a db_clause_t pointer to the added clause or NULL on error.

Definition at line 798 of file hsm_key.c.

◆ hsm_key_backup()

Get the backup of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
a hsm_key_backup_t which may be HSM_KEY_BACKUP_INVALID on error or if no backup has been set.

Definition at line 576 of file hsm_key.c.

References hsm_key::backup, and HSM_KEY_BACKUP_INVALID.

◆ hsm_key_backup_clause()

db_clause_t * hsm_key_backup_clause ( db_clause_list_t clause_list,
hsm_key_backup_t  backup 
)

Create a clause for backup of a hsm key object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters
[in]clause_listdb_clause_list_t pointer.
[in]backupa hsm_key_backup_t.
Returns
a db_clause_t pointer to the added clause or NULL on error.

Definition at line 906 of file hsm_key.c.

◆ hsm_key_bits()

unsigned int hsm_key_bits ( const hsm_key_t hsm_key)

Get the bits of a hsm key object. Undefined behavior if hsm_key is NULL.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
an unsigned integer.

Definition at line 536 of file hsm_key.c.

References hsm_key::bits.

◆ hsm_key_bits_clause()

db_clause_t * hsm_key_bits_clause ( db_clause_list_t clause_list,
unsigned int  bits 
)

Create a clause for bits of a hsm key object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters
[in]clause_listdb_clause_list_t pointer.
[in]bitsan unsigned integer.
Returns
a db_clause_t pointer to the added clause or NULL on error.

Definition at line 777 of file hsm_key.c.

◆ hsm_key_copy()

int hsm_key_copy ( hsm_key_t hsm_key,
const hsm_key_t hsm_key_copy 
)

◆ hsm_key_count()

int hsm_key_count ( hsm_key_t hsm_key,
db_clause_list_t clause_list,
size_t *  count 
)

Count the number of hsm key objects in the database, if a selection of objects should be counted then it can be limited by a database clause list otherwise all objects are counted.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]clause_lista db_clause_list_t pointer or NULL if all objects.
[out]counta size_t pointer to where the count should be stored. should be counted.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1435 of file hsm_key.c.

◆ hsm_key_create()

int hsm_key_create ( hsm_key_t hsm_key)

Create a hsm key object in the database.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 927 of file hsm_key.c.

◆ hsm_key_free()

void hsm_key_free ( hsm_key_t hsm_key)

◆ hsm_key_from_result()

int hsm_key_from_result ( hsm_key_t hsm_key,
const db_result_t result 
)

Set the content of a hsm key object based on a database result.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]resulta db_result_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 405 of file hsm_key.c.

◆ hsm_key_get_by_id()

int hsm_key_get_by_id ( hsm_key_t hsm_key,
const db_value_t id 
)

Get a hsm key object from the database by a id specified in id.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]ida db_value_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1102 of file hsm_key.c.

Referenced by key_data_cache_hsm_key(), and key_data_get_hsm_key().

◆ hsm_key_get_by_locator()

int hsm_key_get_by_locator ( hsm_key_t hsm_key,
const char *  locator 
)

Get a hsm key object from the database by a locator specified in locator.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]locatora character pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1155 of file hsm_key.c.

◆ hsm_key_id()

const db_value_t * hsm_key_id ( const hsm_key_t hsm_key)

Get the id of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
a db_value_t pointer or NULL on error.

Definition at line 504 of file hsm_key.c.

References hsm_key::id.

Referenced by key_data_get_hsm_key(), and key_data_set_hsm_key_id().

◆ hsm_key_inception()

unsigned int hsm_key_inception ( const hsm_key_t hsm_key)

Get the inception of a hsm key object. Undefined behavior if hsm_key is NULL.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
an unsigned integer.

Definition at line 560 of file hsm_key.c.

References hsm_key::inception.

◆ hsm_key_is_revoked_clause()

db_clause_t * hsm_key_is_revoked_clause ( db_clause_list_t clause_list,
unsigned int  is_revoked 
)

Create a clause for is_revoked of a hsm key object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters
[in]clause_listdb_clause_list_t pointer.
[in]is_revokedan unsigned integer.
Returns
a db_clause_t pointer to the added clause or NULL on error.

Definition at line 840 of file hsm_key.c.

◆ hsm_key_key_type_clause()

db_clause_t * hsm_key_key_type_clause ( db_clause_list_t clause_list,
hsm_key_key_type_t  key_type 
)

Create a clause for key_type of a hsm key object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters
[in]clause_listdb_clause_list_t pointer.
[in]key_typea hsm_key_key_type_t.
Returns
a db_clause_t pointer to the added clause or NULL on error.

Definition at line 861 of file hsm_key.c.

◆ hsm_key_list_begin()

const hsm_key_t * hsm_key_list_begin ( hsm_key_list_t hsm_key_list)

Get the first hsm key object in a hsm key object list and reset the position of the list.

Parameters
[in]hsm_key_lista hsm_key_list_t pointer.
Returns
a hsm_key_t pointer or NULL on error or if there are no hsm key objects in the hsm key object list.

Definition at line 1832 of file hsm_key.c.

◆ hsm_key_list_copy()

int hsm_key_list_copy ( hsm_key_list_t hsm_key_list,
const hsm_key_list_t from_hsm_key_list 
)

free global allocator. hsm_key_list_free MUST be called for all its contents. Copy the content of another hsm key object list.

Parameters
[in]hsm_key_lista hsm_key_list_t pointer.
[in]from_hsm_key_lista hsm_key_list_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1524 of file hsm_key.c.

References hsm_key_list::associated_fetch, DB_ERROR_UNKNOWN, DB_OK, db_result_list_free(), db_result_list_new_copy(), hsm_key_free(), hsm_key_new_copy(), hsm_key_list::object_list, hsm_key_list::object_list_first, hsm_key_list::object_list_position, hsm_key_list::object_list_size, hsm_key_list::object_store, hsm_key_list::policy_id_list, policy_list_new_copy(), and hsm_key_list::result_list.

Referenced by hsm_key_list_new_copy().

◆ hsm_key_list_free()

void hsm_key_list_free ( hsm_key_list_t hsm_key_list)

◆ hsm_key_list_get_begin()

hsm_key_t * hsm_key_list_get_begin ( hsm_key_list_t hsm_key_list)

Get the first hsm key object in a hsm key object list and reset the position of the list. The caller will be given ownership of this object and is responsible for freeing it.

Parameters
[in]hsm_key_lista hsm_key_list_t pointer.
Returns
a hsm_key_t pointer or NULL on error or if there are no hsm key objects in the hsm key object list.

Definition at line 1888 of file hsm_key.c.

◆ hsm_key_list_get_by_clauses()

int hsm_key_list_get_by_clauses ( hsm_key_list_t hsm_key_list,
const db_clause_list_t clause_list 
)

Get hsm key objects from the database by a clause list.

Parameters
[in]hsm_key_lista hsm_key_list_t pointer.
[in]clause_lista db_clause_list_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1684 of file hsm_key.c.

◆ hsm_key_list_get_by_policy_id()

int hsm_key_list_get_by_policy_id ( hsm_key_list_t hsm_key_list,
const db_value_t policy_id 
)

Get hsm key objects from the database by a policy_id specified in policy_id.

Parameters
[in]hsm_key_lista hsm_key_list_t pointer.
[in]policy_ida db_value_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1746 of file hsm_key.c.

◆ hsm_key_list_get_next()

hsm_key_t * hsm_key_list_get_next ( hsm_key_list_t hsm_key_list)

Get the next hsm key object in a hsm key object list. The caller will be given ownership of this object and is responsible for freeing it.

Parameters
[in]hsm_key_lista hsm_key_list_t pointer.
Returns
a hsm_key_t pointer or NULL on error or if there are no more hsm key objects in the hsm key object list.

Definition at line 1990 of file hsm_key.c.

◆ hsm_key_list_new()

hsm_key_list_t * hsm_key_list_new ( const db_connection_t connection)

Create a new hsm key object list.

Parameters
[in]connectiona db_connection_t pointer.
Returns
a hsm_key_list_t pointer or NULL on error.

Definition at line 1453 of file hsm_key.c.

Referenced by hsm_key_list_new_copy().

◆ hsm_key_list_new_copy()

hsm_key_list_t * hsm_key_list_new_copy ( const hsm_key_list_t hsm_key_copy)

Create a new hsm key object list that is a copy of another.

Parameters
[in]hsm_key_lista hsm_key_list_t pointer.
Returns
a hsm_key_list_t pointer or NULL on error.

Definition at line 1467 of file hsm_key.c.

References db_object_connection(), hsm_key_list::dbo, hsm_key_list_copy(), hsm_key_list_free(), and hsm_key_list_new().

Referenced by key_data_list_copy(), and policy_copy().

◆ hsm_key_list_new_get_by_clauses()

hsm_key_list_t * hsm_key_list_new_get_by_clauses ( const db_connection_t connection,
const db_clause_list_t clause_list 
)

Get a new list of hsm key objects from the database by a clause list.

Parameters
[in]connectiona db_connection_t pointer.
[in]clause_lista db_clause_list_t pointer.
Returns
a hsm_key_list_t pointer or NULL on error.

Definition at line 1726 of file hsm_key.c.

◆ hsm_key_list_new_get_by_policy_id()

hsm_key_list_t * hsm_key_list_new_get_by_policy_id ( const db_connection_t connection,
const db_value_t policy_id 
)

Get a new list of hsm key objects from the database by a policy_id specified in policy_id.

Parameters
[in]connectiona db_connection_t pointer.
[in]policy_ida db_value_t pointer.
Returns
a hsm_key_list_t pointer or NULL on error.

Definition at line 1809 of file hsm_key.c.

◆ hsm_key_list_next()

const hsm_key_t * hsm_key_list_next ( hsm_key_list_t hsm_key_list)

Get the next hsm key object in a hsm key object list. Ownership of this object is retained within the list and the object is only valid until the next call to this function.

Parameters
[in]hsm_key_lista hsm_key_list_t pointer.
Returns
a hsm_key_t pointer or NULL on error or if there are no more hsm key objects in the hsm key object list.

Definition at line 1924 of file hsm_key.c.

◆ hsm_key_list_object_store()

int hsm_key_list_object_store ( hsm_key_list_t hsm_key_list)

Specify that objects should be stored within the list as they are fetch, this is optimal if the list is to be iterated over more then once.

Parameters
[in]hsm_key_lista hsm_key_list_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1486 of file hsm_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and hsm_key_list::object_store.

◆ hsm_key_locator()

const char * hsm_key_locator ( const hsm_key_t hsm_key)

Get the locator of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
a character pointer or NULL on error or if no locator has been set.

Definition at line 520 of file hsm_key.c.

References hsm_key::locator.

◆ hsm_key_new()

hsm_key_t * hsm_key_new ( const db_connection_t connection)

Create a new hsm key object.

Parameters
[in]connectiona db_connection_t pointer.
Returns
a hsm_key_t pointer or NULL on error.

Definition at line 244 of file hsm_key.c.

Referenced by hsm_key_new_copy(), key_data_cache_hsm_key(), and key_data_get_hsm_key().

◆ hsm_key_new_copy()

hsm_key_t * hsm_key_new_copy ( const hsm_key_t hsm_key)

Create a new hsm key object that is a copy of another hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
a hsm_key_t pointer or NULL on error.

Definition at line 267 of file hsm_key.c.

References db_object_connection(), hsm_key::dbo, hsm_key_copy(), hsm_key_free(), and hsm_key_new().

Referenced by hsm_key_list_copy(), and key_data_copy().

◆ hsm_key_new_get_by_locator()

hsm_key_t * hsm_key_new_get_by_locator ( const db_connection_t connection,
const char *  locator 
)

Get a new hsm key object from the database by a locator specified in locator.

Parameters
[in]connectiona db_connection_t pointer.
[in]locatora character pointer.
Returns
a hsm_key_t pointer or NULL on error or if it does not exist.

Definition at line 1205 of file hsm_key.c.

◆ hsm_key_policy_id()

const db_value_t * hsm_key_policy_id ( const hsm_key_t hsm_key)

Get the policy_id of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
a db_value_t pointer or NULL on error.

Definition at line 512 of file hsm_key.c.

References hsm_key::policy_id.

◆ hsm_key_policy_id_clause()

db_clause_t * hsm_key_policy_id_clause ( db_clause_list_t clause_list,
const db_value_t policy_id 
)

Create a clause for policy_id of a hsm key object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters
[in]clause_listdb_clause_list_t pointer.
[in]policy_ida db_value_t pointer.
Returns
a db_clause_t pointer to the added clause or NULL on error.

Definition at line 729 of file hsm_key.c.

◆ hsm_key_repository()

const char * hsm_key_repository ( const hsm_key_t hsm_key)

Get the repository of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
a character pointer or NULL on error or if no repository has been set.

Definition at line 568 of file hsm_key.c.

References hsm_key::repository.

◆ hsm_key_repository_clause()

db_clause_t * hsm_key_repository_clause ( db_clause_list_t clause_list,
const char *  repository_text 
)

Create a clause for repository of a hsm key object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters
[in]clause_listdb_clause_list_t pointer.
[in]repository_texta character pointer.
Returns
a db_clause_t pointer to the added clause or NULL on error.

Definition at line 882 of file hsm_key.c.

◆ hsm_key_role()

hsm_key_role_t hsm_key_role ( const hsm_key_t hsm_key)

Get the role of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
a hsm_key_role_t which may be HSM_KEY_ROLE_INVALID on error or if no role has been set.

Definition at line 552 of file hsm_key.c.

References HSM_KEY_ROLE_INVALID, and hsm_key::role.

◆ hsm_key_role_clause()

db_clause_t * hsm_key_role_clause ( db_clause_list_t clause_list,
hsm_key_role_t  role 
)

Create a clause for role of a hsm key object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters
[in]clause_listdb_clause_list_t pointer.
[in]rolea hsm_key_role_t.
Returns
a db_clause_t pointer to the added clause or NULL on error.

Definition at line 819 of file hsm_key.c.

◆ hsm_key_set_algorithm()

int hsm_key_set_algorithm ( hsm_key_t hsm_key,
unsigned int  algorithm 
)

Set the algorithm of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]algorithman unsigned integer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 648 of file hsm_key.c.

References hsm_key::algorithm, DB_ERROR_UNKNOWN, and DB_OK.

◆ hsm_key_set_backup()

int hsm_key_set_backup ( hsm_key_t hsm_key,
hsm_key_backup_t  backup 
)

Set the backup of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]backupa hsm_key_backup_t.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 716 of file hsm_key.c.

References hsm_key::backup, DB_ERROR_UNKNOWN, DB_OK, and HSM_KEY_BACKUP_INVALID.

◆ hsm_key_set_bits()

int hsm_key_set_bits ( hsm_key_t hsm_key,
unsigned int  bits 
)

Set the bits of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]bitsan unsigned integer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 638 of file hsm_key.c.

References hsm_key::bits, DB_ERROR_UNKNOWN, and DB_OK.

◆ hsm_key_set_inception()

int hsm_key_set_inception ( hsm_key_t hsm_key,
unsigned int  inception 
)

Set the inception of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]inceptionan unsigned integer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 671 of file hsm_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and hsm_key::inception.

◆ hsm_key_set_key_type()

int hsm_key_set_key_type ( hsm_key_t hsm_key,
hsm_key_key_type_t  key_type 
)

Set the key_type of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]key_typea hsm_key_key_type_t.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 681 of file hsm_key.c.

References DB_ERROR_UNKNOWN, DB_OK, HSM_KEY_KEY_TYPE_INVALID, and hsm_key::key_type.

◆ hsm_key_set_locator()

int hsm_key_set_locator ( hsm_key_t hsm_key,
const char *  locator_text 
)

Set the locator of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]locator_texta character pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 603 of file hsm_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and hsm_key::locator.

◆ hsm_key_set_policy_id()

int hsm_key_set_policy_id ( hsm_key_t hsm_key,
const db_value_t policy_id 
)

Set the policy_id of a hsm key object. If this fails the original value may have been lost.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]policy_ida db_value_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 584 of file hsm_key.c.

References DB_ERROR_UNKNOWN, DB_OK, db_value_copy(), db_value_not_empty(), db_value_reset(), hsm_key::policy_id, and policy_id().

◆ hsm_key_set_repository()

int hsm_key_set_repository ( hsm_key_t hsm_key,
const char *  repository_text 
)

Set the repository of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]repository_texta character pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 694 of file hsm_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and hsm_key::repository.

◆ hsm_key_set_role()

int hsm_key_set_role ( hsm_key_t hsm_key,
hsm_key_role_t  role 
)

Set the role of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]rolea hsm_key_role_t.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 658 of file hsm_key.c.

References DB_ERROR_UNKNOWN, DB_OK, HSM_KEY_ROLE_INVALID, and hsm_key::role.

◆ hsm_key_set_state()

int hsm_key_set_state ( hsm_key_t hsm_key,
hsm_key_state_t  state 
)

Set the state of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
[in]statea hsm_key_state_t.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 625 of file hsm_key.c.

References DB_ERROR_UNKNOWN, DB_OK, HSM_KEY_STATE_INVALID, and hsm_key::state.

◆ hsm_key_state()

hsm_key_state_t hsm_key_state ( const hsm_key_t hsm_key)

Get the state of a hsm key object.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
a hsm_key_state_t which may be HSM_KEY_STATE_INVALID on error or if no state has been set.

Definition at line 528 of file hsm_key.c.

References HSM_KEY_STATE_INVALID, and hsm_key::state.

◆ hsm_key_state_clause()

db_clause_t * hsm_key_state_clause ( db_clause_list_t clause_list,
hsm_key_state_t  state 
)

Create a clause for state of a hsm key object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters
[in]clause_listdb_clause_list_t pointer.
[in]statea hsm_key_state_t.
Returns
a db_clause_t pointer to the added clause or NULL on error.

Definition at line 756 of file hsm_key.c.

◆ hsm_key_update()

int hsm_key_update ( hsm_key_t hsm_key)

Update a hsm key object in the database.

Parameters
[in]hsm_keya hsm_key_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1225 of file hsm_key.c.

Variable Documentation

◆ hsm_key_enum_set_backup

const db_enum_t hsm_key_enum_set_backup[]
Initial value:
= {
{ NULL, 0 }
}
enum hsm_key_backup hsm_key_backup_t
@ HSM_KEY_BACKUP_BACKUP_REQUESTED
Definition: hsm_key.h:68
@ HSM_KEY_BACKUP_NO_BACKUP
Definition: hsm_key.h:66
@ HSM_KEY_BACKUP_BACKUP_DONE
Definition: hsm_key.h:69
@ HSM_KEY_BACKUP_BACKUP_REQUIRED
Definition: hsm_key.h:67

Definition at line 56 of file hsm_key.c.

Referenced by hsm_key_to_backup_state().

◆ hsm_key_enum_set_key_type

const db_enum_t hsm_key_enum_set_key_type[]
Initial value:
= {
{ NULL, 0 }
}
enum hsm_key_key_type hsm_key_key_type_t
@ HSM_KEY_KEY_TYPE_RSA
Definition: hsm_key.h:61

Definition at line 51 of file hsm_key.c.

◆ hsm_key_enum_set_role

const db_enum_t hsm_key_enum_set_role[]
Initial value:
= {
{ NULL, 0 }
}
enum hsm_key_role hsm_key_role_t
@ HSM_KEY_ROLE_KSK
Definition: hsm_key.h:51
@ HSM_KEY_ROLE_ZSK
Definition: hsm_key.h:52
@ HSM_KEY_ROLE_CSK
Definition: hsm_key.h:53

Definition at line 44 of file hsm_key.c.

◆ hsm_key_enum_set_state

const db_enum_t hsm_key_enum_set_state[]
Initial value:
= {
{ NULL, 0 }
}
enum hsm_key_state hsm_key_state_t
@ HSM_KEY_STATE_UNUSED
Definition: hsm_key.h:42
@ HSM_KEY_STATE_PRIVATE
Definition: hsm_key.h:43
@ HSM_KEY_STATE_SHARED
Definition: hsm_key.h:44
@ HSM_KEY_STATE_DELETE
Definition: hsm_key.h:45

Definition at line 36 of file hsm_key.c.