From addf9ce1e66625015db09de61c39061c4ac9b8e0 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Mon, 17 Jul 2017 14:14:32 -0400 Subject: [PATCH] Output key expiration time on a successful request --- tid/example/tidc_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tid/example/tidc_main.c b/tid/example/tidc_main.c index 8697ece..26fb994 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))) { -- 2.1.4