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.
@@ -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
*/
