37 {
41
43
44 const char *connector_url;
45
46 connector_url = getenv("DEFAULT_CONNECTOR_URL");
47 if (connector_url == NULL) {
49 }
50
53
56
59
63
66
70
71 printf(
"Successfully established session %02d using Authentication Keys "
72 "%04x\n",
73 session_id, authkey);
74
78
82
89
90 printf(
"Imported Authentication Key with ID %04x\n",
key_id);
91
94
97
98 printf(
"Closed session %02d\n", session_id);
99
103
106
109
110 printf(
"Successfully established session %02d using Authentication Key "
111 "%04x\n",
113
114 printf(
"Trying to get 16 bytes of random data\n");
115
117 size_t data_len = sizeof(data);
120
122
125
128
131
134
135 return 0;
136}
CK_SESSION_HANDLE session
const uint8_t password2[]
#define DEFAULT_CONNECTOR_URL
const uint8_t password1[]
const char * yh_strerror(yh_rc err)
LOGGING_API void printf(Category category, const char *format,...)
Capabilities representation.
yh_rc yh_destroy_session(yh_session **session)
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_close_session(yh_session *session)
yh_rc yh_authenticate_session(yh_session *session)
yh_rc yh_util_import_authentication_key_derived(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, const yh_capabilities *delegated_capabilities, const uint8_t *password, size_t password_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_rc yh_util_get_pseudo_random(yh_session *session, size_t len, uint8_t *out, size_t *out_len)
@ YHR_DEVICE_INSUFFICIENT_PERMISSIONS
Return value when the permissions to perform the operation are wrong.
@ YHR_GENERIC_ERROR
Return value when encountering an unknown error.
@ YHR_SUCCESS
Returned value when function was successful.
yh_capabilities capabilities