X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=tid%2Fexample%2Ftidc_main.c;h=02cd1db58faf5fbb08c2fbbbd3834b785cbb702e;hb=3c5fb17459ff56d5e23cea059503f46a42150a1e;hp=8697ecec2cc710907700bb5c89d749ee5808bb8f;hpb=196707bb546875b9c07ffd92c9b16e524b087632;p=trust_router.git diff --git a/tid/example/tidc_main.c b/tid/example/tidc_main.c index 8697ece..02cd1db 100644 --- a/tid/example/tidc_main.c +++ b/tid/example/tidc_main.c @@ -41,6 +41,7 @@ #include #include #include +#include static void tidc_resp_handler (TIDC_INSTANCE * tidc, TID_REQ *req, @@ -50,6 +51,7 @@ static void tidc_resp_handler (TIDC_INSTANCE * tidc, int c_keylen = 0; unsigned char *c_keybuf = NULL; int i; + struct timeval tv; printf ("Response received! Realm = %s, Community = %s.\n", resp->realm->buf, resp->comm->buf); @@ -63,7 +65,12 @@ static void tidc_resp_handler (TIDC_INSTANCE * tidc, fprintf(stderr, "tidc_resp_handler: Response does not contain server info.\n"); return; } - + if (tid_srvr_get_key_expiration(tid_resp_get_server(resp, 0), &tv)) + printf("Error reading key expiration\n"); + else + printf("Key expiration: %s", ctime(&tv.tv_sec)); + + if (0 > (c_keylen = tr_compute_dh_key(&c_keybuf, resp->servers->aaa_server_dh->pub_key, req->tidc_dh))) { @@ -203,7 +210,8 @@ int main (int argc, /* Create a TID client instance & the client DH */ tidc = tidc_create(); - if (NULL == (tidc->client_dh = tr_create_dh_params(NULL, 0))) { + tidc_set_dh(tidc, tr_create_dh_params(NULL, 0)); + if (tidc_get_dh(tidc) == NULL) { printf("Error creating client DH params.\n"); return 1; }