From bfcf8cb0fa719de60f496308e41a10fa8f06dfca Mon Sep 17 00:00:00 2001 From: Junyeon LEE Date: Mon, 10 Apr 2017 17:42:55 +0900 Subject: [PATCH] examples/tls_client: support client key authentication This commit adds key parsing routine in client example. Because sometimes server requires client's signature for authentication. Change-Id: Iddcf87417bac0e4eba092df845ee20b00597fad5 Signed-off-by: Junyeon LEE --- apps/examples/tls_client/tls_client_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/examples/tls_client/tls_client_main.c b/apps/examples/tls_client/tls_client_main.c index 9b7fe2b..867db82 100644 --- a/apps/examples/tls_client/tls_client_main.c +++ b/apps/examples/tls_client/tls_client_main.c @@ -925,7 +925,7 @@ usage: mbedtls_printf(" ok (%d skipped)\n", ret); /* - * 1.2. Load own certificate + * 1.2. Load own certificate and key */ mbedtls_printf(" . Loading the own cert..."); fflush(stdout); @@ -938,6 +938,15 @@ usage: mbedtls_printf(" ok\n"); + mbedtls_printf(" . Loading the Private Key..."); + fflush(stdout); + + if ((ret = mbedtls_pk_parse_key(&pkey, (const unsigned char *) mbedtls_test_cli_key_rsa, mbedtls_test_cli_key_rsa_len, NULL, 0)) != 0) + { + mbedtls_printf(" failed\n ! mbedtls_pk_parse_key returned %d\n\n", ret); + goto exit; + } + /* * 2. Start the connection */ -- 2.7.4