28#ifndef DEFAULT_CONNECTOR_URL
29#define DEFAULT_CONNECTOR_URL "http://127.0.0.1:12345"
44 const char *connector_url;
46 connector_url = getenv(
"DEFAULT_CONNECTOR_URL");
47 if (connector_url == NULL) {
61 sizeof(password),
false, &
session);
71 printf(
"Successfully established session %02d\n", session_id);
91 printf(
"Generated wrapping key with ID %04x\n", wrapping_key_id);
94 size_t data_len =
sizeof(data);
100 printf(
"Data wrapped to length %zu\n", data_len);
103 assert(memcmp(data,
clear,
sizeof(
clear)) != 0);
109 assert(data_len ==
sizeof(
clear));
110 assert(memcmp(data,
clear,
sizeof(
clear)) == 0);
112 printf(
"Data unwrapped successfully\n");
CK_SESSION_HANDLE session
Capabilities representation.
#define DEFAULT_CONNECTOR_URL
yh_rc yh_destroy_session(yh_session **session)
yh_rc yh_util_generate_wrap_key(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm, const yh_capabilities *delegated_capabilities)
yh_rc yh_create_session_derived(yh_connector *connector, uint16_t authkey_id, const uint8_t *password, size_t password_len, bool recreate, yh_session **session)
yh_rc yh_util_unwrap_data(yh_session *session, uint16_t key_id, const uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len)
yh_rc yh_util_close_session(yh_session *session)
yh_rc yh_authenticate_session(yh_session *session)
yh_rc yh_util_wrap_data(yh_session *session, uint16_t key_id, const uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len)
yh_rc yh_string_to_domains(const char *domains, uint16_t *result)
yh_rc yh_init_connector(const char *url, yh_connector **connector)
yh_rc yh_connect(yh_connector *connector, int timeout)
yh_rc yh_string_to_capabilities(const char *capability, yh_capabilities *result)
yh_rc yh_disconnect(yh_connector *connector)
yh_rc yh_get_session_id(yh_session *session, uint8_t *sid)
@ YH_ALGO_AES256_CCM_WRAP
aes256-ccm-wrap
#define YH_CCM_WRAP_OVERHEAD
@ YHR_GENERIC_ERROR
Return value when encountering an unknown error.
@ YHR_SUCCESS
Returned value when function was successful.
yh_capabilities capabilities
yh_capabilities delegated_capabilities