policy_key.c File Reference
`#include "policy_key.h"`
`#include "db_error.h"`
`#include <string.h>`

Go to the source code of this file.

## Functions

policy_key_t * | policy_key_new (const db_connection_t *connection)
policy_key_t * | policy_key_new_copy (const policy_key_t *policy_key)
void | policy_key_free (policy_key_t *policy_key)
void | policy_key_reset (policy_key_t *policy_key)
int | policy_key_copy (policy_key_t *policy_key, const policy_key_t *policy_key_copy)
int | policy_key_cmp (const policy_key_t *policy_key_a, const policy_key_t *policy_key_b)
int | policy_key_from_result (policy_key_t *policy_key, const db_result_t *result)
const db_value_t * | policy_key_policy_id (const policy_key_t *policy_key)
policy_key_role_t | policy_key_role (const policy_key_t *policy_key)
const char * | policy_key_role_text (const policy_key_t *policy_key)
unsigned int | policy_key_algorithm (const policy_key_t *policy_key)
unsigned int | policy_key_bits (const policy_key_t *policy_key)
unsigned int | policy_key_lifetime (const policy_key_t *policy_key)
const char * | policy_key_repository (const policy_key_t *policy_key)
int | policy_key_standby (const policy_key_t *policy_key)
unsigned int | policy_key_manual_rollover (const policy_key_t *policy_key)
unsigned int | policy_key_rfc5011 (const policy_key_t *policy_key)
unsigned int | policy_key_minimize (const policy_key_t *policy_key)
int | policy_key_set_policy_id (policy_key_t *policy_key, const db_value_t *policy_id)
int | policy_key_set_role (policy_key_t *policy_key, policy_key_role_t role)
int | policy_key_set_algorithm (policy_key_t *policy_key, unsigned int algorithm)
int | policy_key_set_bits (policy_key_t *policy_key, unsigned int bits)
int | policy_key_set_lifetime (policy_key_t *policy_key, unsigned int lifetime)
int | policy_key_set_repository (policy_key_t *policy_key, const char *repository_text)
int | policy_key_set_standby (policy_key_t *policy_key, unsigned int standby)
int | policy_key_set_manual_rollover (policy_key_t *policy_key, unsigned int manual_rollover)
int | policy_key_set_rfc5011 (policy_key_t *policy_key, unsigned int rfc5011)
int | policy_key_set_minimize (policy_key_t *policy_key, unsigned int minimize)
int | policy_key_create (policy_key_t *policy_key)
int | policy_key_get_by_id (policy_key_t *policy_key, const db_value_t *id)
int | policy_key_delete (policy_key_t *policy_key)
policy_key_list_t * | policy_key_list_new (const db_connection_t *connection)
policy_key_list_t * | policy_key_list_new_copy (const policy_key_list_t *from_policy_key_list)
int | policy_key_list_object_store (policy_key_list_t *policy_key_list)
void | policy_key_list_free (policy_key_list_t *policy_key_list)
int | policy_key_list_copy (policy_key_list_t *policy_key_list, const policy_key_list_t *from_policy_key_list)
int | policy_key_list_get_by_clauses (policy_key_list_t *policy_key_list, const db_clause_list_t *clause_list)
int | policy_key_list_get_by_policy_id (policy_key_list_t *policy_key_list, const db_value_t *policy_id)
policy_key_list_t * | policy_key_list_new_get_by_policy_id (const db_connection_t *connection, const db_value_t *policy_id)
const policy_key_t * | policy_key_list_begin (policy_key_list_t *policy_key_list)
const policy_key_t * | policy_key_list_next (policy_key_list_t *policy_key_list)
policy_key_t * | policy_key_list_get_next (policy_key_list_t *policy_key_list)
size_t | policy_key_list_size (policy_key_list_t *policy_key_list)
int | policy_key_get_by_policyid_and_role (policy_key_t *policy_key, const db_value_t *policyid, const policy_key_role_t role)
policy_key_t * | policy_key_new_get_by_policyid_and_role (const db_connection_t *connection, const db_value_t *policyid, const policy_key_role_t role)

## Variables

const db_enum_t | policy_key_enum_set_role []

## Function Documentation

## policy_key_algorithm()

unsigned int policy_key_algorithm | ( | const policy_key_t * | policy_key | ) |

Get the algorithm of a policy key object. Undefined behavior if `policy_key` is NULL.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  an unsigned integer.

Definition at line 510 of file policy_key.c.

References policy_key::algorithm.

Referenced by hsm_key_factory_generate(), hsm_key_factory_get_key(), and hsm_key_list_new_get_by_policy_key().

## policy_key_bits()

unsigned int policy_key_bits | ( | const policy_key_t * | policy_key | ) |

Get the bits of a policy key object. Undefined behavior if `policy_key` is NULL.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  an unsigned integer.

Definition at line 518 of file policy_key.c.

References policy_key::bits.

Referenced by hsm_key_factory_generate(), hsm_key_factory_get_key(), and hsm_key_list_new_get_by_policy_key().

## policy_key_cmp()

int policy_key_cmp | ( | const policy_key_t * | policy_key_a,
|  | const policy_key_t * | policy_key_b
| ) |  |

Compare two policy key objects and return less than, equal to, or greater than zero if A is found, respectively, to be less than, to match, or be greater than B.

Parameters

  [in] | policy_key_a | a policy_key_t pointer.
  [in] | policy_key_b | a policy_key_t pointer.

Returns
  less than, equal to, or greater than zero if A is found, respectively, to be less than, to match, or be greater than B.

Definition at line 359 of file policy_key.c.

References policy_key::algorithm, policy_key::bits, db_value_cmp(), policy_key::lifetime, policy_key::manual_rollover, policy_key::minimize, policy_key::policy_id, policy_key::repository, policy_key::rfc5011, policy_key::role, and policy_key::standby.

Referenced by policy_import().

## policy_key_copy()

int policy_key_copy | ( | policy_key_t * | policy_key,
|  | const policy_key_t * | policy_key_copy
| ) |  |

Copy the content of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | policy_key_copy | a policy_key_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 289 of file policy_key.c.

References policy_key::algorithm, policy_key::associated_policy_id, policy_key::bits, DB_ERROR_UNKNOWN, DB_OK, db_value_copy(), policy_key::id, policy_key::lifetime, policy_key::manual_rollover, policy_key::minimize, policy_free(), policy_key::policy_id, policy_key_copy(), policy_new_copy(), policy_key::private_policy_id, policy_key::repository, policy_key::rev, policy_key::rfc5011, policy_key::role, and policy_key::standby.

Referenced by policy_import(), policy_key_copy(), policy_key_list_get_next(), and policy_key_new_copy().

## policy_key_create()

int policy_key_create | ( | policy_key_t * | policy_key | ) |

Create a policy key object in the database.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 702 of file policy_key.c.

References policy_key::algorithm, policy_key::bits, DB_ERROR_UNKNOWN, db_object_create(), db_object_field_free(), db_object_field_list_add(), db_object_field_list_free(), db_object_field_list_new(), db_object_field_new(), db_object_field_set_enum_set(), db_object_field_set_name(), db_object_field_set_type(), DB_TYPE_ANY, DB_TYPE_ENUM, DB_TYPE_TEXT, DB_TYPE_UINT32, db_value_copy(), db_value_from_enum_value(), db_value_from_text(), db_value_from_uint32(), db_value_not_empty(), db_value_set_free(), db_value_set_get(), db_value_set_new(), policy_key::dbo, policy_key::id, policy_key::lifetime, policy_key::manual_rollover, policy_key::minimize, policy_key::policy_id, policy_key_enum_set_role, policy_key::repository, policy_key::rev, policy_key::rfc5011, policy_key::role, and policy_key::standby.

Referenced by policy_import().

## policy_key_delete()

int policy_key_delete | ( | policy_key_t * | policy_key | ) |

Delete a policy key object from the database.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 913 of file policy_key.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), DB_ERROR_UNKNOWN, db_object_delete(), db_value_copy(), db_value_not_empty(), policy_key::dbo, policy_key::id, and policy_key::rev.

Referenced by policy_import().

## policy_key_free()

void policy_key_free | ( | policy_key_t * | policy_key | ) |

Delete a policy key object, this does not delete it from the database.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Definition at line 246 of file policy_key.c.

References db_object_free(), db_value_reset(), policy_key::dbo, policy_key::id, policy_free(), policy_key::policy_id, policy_key::private_policy_id, policy_key::repository, and policy_key::rev.

Referenced by policy_import(), policy_key_list_copy(), policy_key_list_free(), policy_key_list_get_by_clauses(), policy_key_list_get_by_policy_id(), policy_key_list_get_next(), policy_key_new_copy(), and policy_key_new_get_by_policyid_and_role().

## policy_key_from_result()

int policy_key_from_result | ( | policy_key_t * | policy_key,
|  | const db_result_t * | result
| ) |  |

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

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | result | a db_result_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 426 of file policy_key.c.

References policy_key::algorithm, policy_key::bits, DB_ERROR_UNKNOWN, DB_OK, db_result_value_set(), db_value_copy(), db_value_reset(), db_value_set_at(), db_value_set_size(), db_value_to_enum_value(), db_value_to_text(), db_value_to_uint32(), policy_key::id, policy_key::lifetime, policy_key::manual_rollover, policy_key::minimize, policy_key::policy_id, policy_key_enum_set_role, POLICY_KEY_ROLE_CSK, POLICY_KEY_ROLE_KSK, POLICY_KEY_ROLE_ZSK, policy_key::repository, policy_key::rev, policy_key::rfc5011, policy_key::role, and policy_key::standby.

Referenced by policy_key_get_by_id(), policy_key_get_by_policyid_and_role(), policy_key_list_begin(), policy_key_list_get_next(), and policy_key_list_next().

## policy_key_get_by_id()

int policy_key_get_by_id | ( | policy_key_t * | policy_key,
|  | const db_value_t * | id
| ) |  |

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

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 860 of file policy_key.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), DB_ERROR_UNKNOWN, db_object_read(), DB_OK, db_result_list_free(), db_result_list_next(), db_value_copy(), db_value_not_empty(), policy_key::dbo, and policy_key_from_result().

## policy_key_get_by_policyid_and_role()

int policy_key_get_by_policyid_and_role | ( | policy_key_t * | policy_key,
|  | const db_value_t * | policyid,
|  | const policy_key_role_t | role
| ) |  |

Definition at line 1498 of file policy_key.c.

References DB_CLAUSE_EQUAL, db_clause_free(), 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_ERROR_UNKNOWN, db_object_read(), DB_OK, db_result_list_free(), db_result_list_next(), db_value_copy(), db_value_from_enum_value(), policy_key::dbo, policy_key_enum_set_role, and policy_key_from_result().

Referenced by policy_key_new_get_by_policyid_and_role().

## policy_key_lifetime()

unsigned int policy_key_lifetime | ( | const policy_key_t * | policy_key | ) |

Get the lifetime of a policy key object. Undefined behavior if `policy_key` is NULL.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  an unsigned integer.

Definition at line 526 of file policy_key.c.

References policy_key::lifetime.

Referenced by hsm_key_factory_generate().

## policy_key_list_begin()

const policy_key_t * policy_key_list_begin | ( | policy_key_list_t * | policy_key_list | ) |

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

Parameters

  [in] | policy_key_list | a policy_key_list_t pointer.

Returns
  a policy_key_t pointer or NULL on error or if there are no policy key objects in the policy key object list.

Definition at line 1322 of file policy_key.c.

References db_object_connection(), db_result_list_begin(), db_result_list_size(), policy_key_list::dbo, policy_key_list::object_list, policy_key_list::object_list_position, policy_key_list::object_list_size, policy_key_list::object_store, policy_key_list::policy_key, policy_key_from_result(), policy_key_new(), and policy_key_list::result_list.

## policy_key_list_copy()

int policy_key_list_copy | ( | policy_key_list_t * | policy_key_list,
|  | const policy_key_list_t * | from_policy_key_list
| ) |  |

Copy the content of another policy key object list.

Parameters

  [in] | policy_key_list | a policy_key_list_t pointer.
  [in] | from_policy_key_list | a policy_key_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1034 of file policy_key.c.

References policy_key_list::associated_fetch, DB_ERROR_UNKNOWN, DB_OK, db_result_list_free(), db_result_list_new_copy(), policy_key_list::object_list, policy_key_list::object_list_first, policy_key_list::object_list_position, policy_key_list::object_list_size, policy_key_list::object_store, policy_key_list::policy_id_list, policy_key_free(), policy_key_new_copy(), policy_list_new_copy(), and policy_key_list::result_list.

Referenced by policy_key_list_new_copy().

## policy_key_list_free()

void policy_key_list_free | ( | policy_key_list_t * | policy_key_list | ) |

Delete a policy key object list.

Parameters

  [in] | policy_key_list | a policy_key_list_t pointer.

Definition at line 1006 of file policy_key.c.

References db_object_free(), db_result_list_free(), policy_key_list::dbo, policy_key_list::object_list, policy_key_list::object_list_size, policy_key_list::policy_id_list, policy_key_list::policy_key, policy_key_free(), policy_list_free(), and policy_key_list::result_list.

Referenced by hsm_key_factory_generate_all(), hsm_key_factory_generate_policy(), policy_copy(), policy_free(), policy_import(), policy_key_list_new_copy(), and policy_key_list_new_get_by_policy_id().

## policy_key_list_get_by_clauses()

int policy_key_list_get_by_clauses | ( | policy_key_list_t * | policy_key_list,
|  | const db_clause_list_t * | clause_list
| ) |  |

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

Parameters

  [in] | policy_key_list | a policy_key_list_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1194 of file policy_key.c.

References policy_key_list::associated_fetch, DB_ERROR_UNKNOWN, db_object_read(), DB_OK, db_result_list_fetch_all(), db_result_list_free(), policy_key_list::dbo, policy_key_list::object_list, policy_key_list::object_list_first, policy_key_list::object_list_size, policy_key_free(), and policy_key_list::result_list.

## policy_key_list_get_by_policy_id()

int policy_key_list_get_by_policy_id | ( | policy_key_list_t * | policy_key_list,
|  | const db_value_t * | policy_id
| ) |  |

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

Parameters

  [in] | policy_key_list | a policy_key_list_t pointer.
  [in] | policy_id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1236 of file policy_key.c.

References policy_key_list::associated_fetch, DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), DB_ERROR_UNKNOWN, db_object_read(), DB_OK, db_result_list_fetch_all(), db_result_list_free(), db_value_copy(), db_value_not_empty(), policy_key_list::dbo, policy_key_list::object_list, policy_key_list::object_list_first, policy_key_list::object_list_size, policy_id(), policy_key_free(), and policy_key_list::result_list.

Referenced by policy_import(), and policy_key_list_new_get_by_policy_id().

## policy_key_list_get_next()

policy_key_t * policy_key_list_get_next | ( | policy_key_list_t * | policy_key_list | ) |

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

Parameters

  [in] | policy_key_list | a policy_key_list_t pointer.

Returns
  a policy_key_t pointer or NULL on error or if there are no more policy key objects in the policy key object list.

Definition at line 1444 of file policy_key.c.

References db_object_connection(), db_result_list_next(), policy_key_list::dbo, policy_key_list::object_store, policy_key_copy(), policy_key_free(), policy_key_from_result(), policy_key_list_next(), policy_key_new(), and policy_key_list::result_list.

Referenced by policy_import().

## policy_key_list_new()

policy_key_list_t * policy_key_list_new | ( | const db_connection_t * | connection | ) |

Create a new policy key object list.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a policy_key_list_t pointer or NULL on error.

Definition at line 963 of file policy_key.c.

References policy_key_list::dbo.

Referenced by policy_import(), policy_key_list_new_copy(), and policy_key_list_new_get_by_policy_id().

## policy_key_list_new_copy()

policy_key_list_t * policy_key_list_new_copy | ( | const policy_key_list_t * | policy_key_copy | ) |

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

Parameters

  [in] | policy_key_list | a policy_key_list_t pointer.

Returns
  a policy_key_list_t pointer or NULL on error.

Definition at line 977 of file policy_key.c.

References db_object_connection(), policy_key_list::dbo, policy_key_list_copy(), policy_key_list_free(), and policy_key_list_new().

Referenced by policy_copy().

## policy_key_list_new_get_by_policy_id()

policy_key_list_t * policy_key_list_new_get_by_policy_id | ( | const db_connection_t * | connection,
|  | const db_value_t * | policy_id
| ) |  |

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

Parameters

  [in] | connection | a db_connection_t pointer.
  [in] | policy_id | a db_value_t pointer.

Returns
  a policy_key_list_t pointer or NULL on error.

Definition at line 1299 of file policy_key.c.

References db_value_not_empty(), policy_id(), policy_key_list_free(), policy_key_list_get_by_policy_id(), and policy_key_list_new().

Referenced by hsm_key_factory_generate_all(), hsm_key_factory_generate_policy(), policy_get_policy_keys(), and policy_import().

## policy_key_list_next()

const policy_key_t * policy_key_list_next | ( | policy_key_list_t * | policy_key_list | ) |

Get the next policy key object in a policy 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] | policy_key_list | a policy_key_list_t pointer.

Returns
  a policy_key_t pointer or NULL on error or if there are no more policy key objects in the policy key object list.

Definition at line 1378 of file policy_key.c.

References db_object_connection(), db_result_list_next(), db_result_list_size(), policy_key_list::dbo, policy_key_list::object_list, policy_key_list::object_list_first, policy_key_list::object_list_position, policy_key_list::object_list_size, policy_key_list::object_store, policy_key_list::policy_key, policy_key_from_result(), policy_key_new(), and policy_key_list::result_list.

Referenced by hsm_key_factory_generate_all(), hsm_key_factory_generate_policy(), policy_import(), and policy_key_list_get_next().

## policy_key_list_object_store()

int policy_key_list_object_store | ( | policy_key_list_t * | policy_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] | policy_key_list | a policy_key_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 996 of file policy_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and policy_key_list::object_store.

## policy_key_list_size()

size_t policy_key_list_size | ( | policy_key_list_t * | policy_key_list | ) |

Get the size of a policy key object list.

Parameters

  [in] | policy_key_list | a policy_key_list_t pointer.

Returns
  a size_t with the size of the list or zero on error, if the list is empty or if the backend does not support returning the size.

Definition at line 1480 of file policy_key.c.

References db_result_list_size(), policy_key_list::object_list, policy_key_list::object_list_size, policy_key_list::object_store, and policy_key_list::result_list.

## policy_key_manual_rollover()

unsigned int policy_key_manual_rollover | ( | const policy_key_t * | policy_key | ) |

Get the manual_rollover of a policy key object. Undefined behavior if `policy_key` is NULL.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  an unsigned integer.

Definition at line 550 of file policy_key.c.

References policy_key::manual_rollover.

## policy_key_minimize()

unsigned int policy_key_minimize | ( | const policy_key_t * | policy_key | ) |

Get the minimize of a policy key object. Undefined behavior if `policy_key` is NULL.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  an unsigned integer.

Definition at line 566 of file policy_key.c.

References policy_key::minimize.

## policy_key_new()

policy_key_t * policy_key_new | ( | const db_connection_t * | connection | ) |

Create a new policy key object.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a policy_key_t pointer or NULL on error.

Definition at line 209 of file policy_key.c.

References db_value_reset(), policy_key::dbo, policy_key::id, policy_key::policy_id, POLICY_KEY_ROLE_INVALID, policy_key::rev, and policy_key::role.

Referenced by policy_import(), policy_key_list_begin(), policy_key_list_get_next(), policy_key_list_next(), policy_key_new_copy(), and policy_key_new_get_by_policyid_and_role().

## policy_key_new_copy()

policy_key_t * policy_key_new_copy | ( | const policy_key_t * | policy_key | ) |

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

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  a policy_key_t pointer or NULL on error.

Definition at line 227 of file policy_key.c.

References db_object_connection(), policy_key::dbo, policy_key_copy(), policy_key_free(), and policy_key_new().

Referenced by policy_key_list_copy().

## policy_key_new_get_by_policyid_and_role()

policy_key_t * policy_key_new_get_by_policyid_and_role | ( | const db_connection_t * | connection,
|  | const db_value_t * | policyid,
|  | const policy_key_role_t | role
| ) |  |

Definition at line 1562 of file policy_key.c.

References policy_key_free(), policy_key_get_by_policyid_and_role(), and policy_key_new().

## policy_key_policy_id()

const db_value_t * policy_key_policy_id | ( | const policy_key_t * | policy_key | ) |

Get the policy_id of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  a db_value_t pointer or NULL on error.

Definition at line 478 of file policy_key.c.

References policy_key::policy_id.

Referenced by hsm_key_factory_generate(), hsm_key_factory_get_key(), and hsm_key_list_new_get_by_policy_key().

## policy_key_repository()

const char * policy_key_repository | ( | const policy_key_t * | policy_key | ) |

Get the repository of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  a character pointer or NULL on error or if no repository has been set.

Definition at line 534 of file policy_key.c.

References policy_key::repository.

Referenced by hsm_key_factory_generate(), hsm_key_factory_get_key(), and hsm_key_list_new_get_by_policy_key().

## policy_key_reset()

void policy_key_reset | ( | policy_key_t * | policy_key | ) |

Reset the content of a policy key object making it as if its new. This does not change anything in the database.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Definition at line 264 of file policy_key.c.

References policy_key::algorithm, policy_key::associated_policy_id, policy_key::bits, db_value_reset(), policy_key::id, policy_key::lifetime, policy_key::manual_rollover, policy_key::minimize, policy_free(), policy_key::policy_id, POLICY_KEY_ROLE_INVALID, policy_key::private_policy_id, policy_key::repository, policy_key::rev, policy_key::rfc5011, policy_key::role, and policy_key::standby.

## policy_key_rfc5011()

unsigned int policy_key_rfc5011 | ( | const policy_key_t * | policy_key | ) |

Get the rfc5011 of a policy key object. Undefined behavior if `policy_key` is NULL.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  an unsigned integer.

Definition at line 558 of file policy_key.c.

References policy_key::rfc5011.

## policy_key_role()

policy_key_role_t policy_key_role | ( | const policy_key_t * | policy_key | ) |

Get the role of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  a policy_key_role_t which may be POLICY_KEY_ROLE_INVALID on error or if no role has been set.

Definition at line 486 of file policy_key.c.

References POLICY_KEY_ROLE_INVALID, and policy_key::role.

## policy_key_role_text()

const char * policy_key_role_text | ( | const policy_key_t * | policy_key | ) |

Get the role as text of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  a character pointer or NULL on error or if no role has been set.

Definition at line 494 of file policy_key.c.

References policy_key_enum_set_role, policy_key::role, db_enum::text, and db_enum::value.

Referenced by hsm_key_factory_generate(), and policy_import().

## policy_key_set_algorithm()

int policy_key_set_algorithm | ( | policy_key_t * | policy_key,
|  | unsigned int | algorithm
| ) |  |

Set the algorithm of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | algorithm | an unsigned integer with a maximum value of 255.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 606 of file policy_key.c.

References policy_key::algorithm, DB_ERROR_UNKNOWN, and DB_OK.

Referenced by policy_key_create_from_xml().

## policy_key_set_bits()

int policy_key_set_bits | ( | policy_key_t * | policy_key,
|  | unsigned int | bits
| ) |  |

Set the bits of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | bits | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 620 of file policy_key.c.

References policy_key::bits, DB_ERROR_UNKNOWN, and DB_OK.

Referenced by policy_key_create_from_xml().

## policy_key_set_lifetime()

int policy_key_set_lifetime | ( | policy_key_t * | policy_key,
|  | unsigned int | lifetime
| ) |  |

Set the lifetime of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | lifetime | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 630 of file policy_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and policy_key::lifetime.

Referenced by policy_key_create_from_xml().

## policy_key_set_manual_rollover()

int policy_key_set_manual_rollover | ( | policy_key_t * | policy_key,
|  | unsigned int | manual_rollover
| ) |  |

Set the manual_rollover of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | manual_rollover | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 672 of file policy_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and policy_key::manual_rollover.

Referenced by policy_key_create_from_xml().

## policy_key_set_minimize()

int policy_key_set_minimize | ( | policy_key_t * | policy_key,
|  | unsigned int | minimize
| ) |  |

Set the minimize of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | minimize | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 692 of file policy_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and policy_key::minimize.

Referenced by policy_key_create_from_xml().

## policy_key_set_policy_id()

int policy_key_set_policy_id | ( | policy_key_t * | policy_key,
|  | const db_value_t * | policy_id
| ) |  |

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

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | policy_id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 574 of file policy_key.c.

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

Referenced by policy_import().

## policy_key_set_repository()

int policy_key_set_repository | ( | policy_key_t * | policy_key,
|  | const char * | repository_text
| ) |  |

Set the repository of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | repository_text | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 640 of file policy_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and policy_key::repository.

Referenced by policy_key_create_from_xml().

## policy_key_set_rfc5011()

int policy_key_set_rfc5011 | ( | policy_key_t * | policy_key,
|  | unsigned int | rfc5011
| ) |  |

Set the rfc5011 of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | rfc5011 | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 682 of file policy_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and policy_key::rfc5011.

Referenced by policy_key_create_from_xml().

## policy_key_set_role()

int policy_key_set_role | ( | policy_key_t * | policy_key,
|  | policy_key_role_t | role
| ) |  |

Set the role of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | role | a policy_key_role_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 593 of file policy_key.c.

References DB_ERROR_UNKNOWN, DB_OK, POLICY_KEY_ROLE_INVALID, and policy_key::role.

Referenced by policy_key_create_from_xml().

## policy_key_set_standby()

int policy_key_set_standby | ( | policy_key_t * | policy_key,
|  | unsigned int | standby
| ) |  |

Set the standby of a policy key object.

Parameters

  [in] | policy_key | a policy_key_t pointer.
  [in] | standby | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 662 of file policy_key.c.

References DB_ERROR_UNKNOWN, DB_OK, and policy_key::standby.

Referenced by policy_key_create_from_xml().

## policy_key_standby()

int policy_key_standby | ( | const policy_key_t * | policy_key | ) |

Get the standby of a policy key object. Undefined behavior if `policy_key` is NULL.

Parameters

  [in] | policy_key | a policy_key_t pointer.

Returns
  an integer.

Definition at line 542 of file policy_key.c.

References policy_key::standby.

## Variable Documentation

## policy_key_enum_set_role

const db_enum_t policy_key_enum_set_role[]

Initial value:
= {
{ "KSK", (policy_key_role_t)POLICY_KEY_ROLE_KSK },
{ "ZSK", (policy_key_role_t)POLICY_KEY_ROLE_ZSK },
{ "CSK", (policy_key_role_t)POLICY_KEY_ROLE_CSK },
{ NULL, 0 }
}
POLICY_KEY_ROLE_KSK
@ POLICY_KEY_ROLE_KSK
Definition policy_key.h:42
POLICY_KEY_ROLE_CSK
@ POLICY_KEY_ROLE_CSK
Definition policy_key.h:44
POLICY_KEY_ROLE_ZSK
@ POLICY_KEY_ROLE_ZSK
Definition policy_key.h:43
policy_key_role_t
enum policy_key_role policy_key_role_t

Definition at line 36 of file policy_key.c.

Referenced by policy_key_create(), policy_key_from_result(), policy_key_get_by_policyid_and_role(), and policy_key_role_text().