From 79ec5264ed3767f5f8c303996f9e79e1f4359bbf Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 16 Aug 2009 09:35:31 +0300 Subject: [PATCH] Use PEM format RSA private key with eap_example It looks like GnuTLS does not know how to parse the previously used DER-formatted PKCS#1 private key (server.key). To work around this, use a PEM-formatted version of the same key. This format can now be used by OpenSSL, GnuTLS, and the internal TLS implementation. --- eap_example/eap_example_server.c | 5 +++-- eap_example/server-key.pem | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 eap_example/server-key.pem diff --git a/eap_example/eap_example_server.c b/eap_example/eap_example_server.c index 897aa2646..0e28995ed 100644 --- a/eap_example/eap_example_server.c +++ b/eap_example/eap_example_server.c @@ -84,8 +84,9 @@ static int eap_example_server_init_tls(void) os_memset(&tparams, 0, sizeof(tparams)); tparams.ca_cert = "ca.pem"; tparams.client_cert = "server.pem"; - tparams.private_key = "server.key"; - tparams.private_key_passwd = "whatever"; + /* tparams.private_key = "server.key"; */ + tparams.private_key = "server-key.pem"; + /* tparams.private_key_passwd = "whatever"; */ if (tls_global_set_params(eap_ctx.tls_ctx, &tparams)) { printf("Failed to set TLS parameters\n"); diff --git a/eap_example/server-key.pem b/eap_example/server-key.pem new file mode 100644 index 000000000..d98c4dd05 --- /dev/null +++ b/eap_example/server-key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDToYuDPmjEWu+/Aj0RVWTSb07sX6dAkPnrTaUjZAG5AhjRqJWz +zD50kFmVKi+R7GgS5tlGzLUtokdwjuSUAmz8tMXwIwmVeS0HluFDVSi94XbVRczE ++nyoDigg1RGyy1mc3t5RG84bvNatq98OceJag4ngh8L8I4k1qTLRMlyBJwIDAQAB +AoGAP+v0asDn/h8FeSkg7uJfIJyUNxsxNnRTuHnsXkMvrgTvICyOgw828hhDpqVm +VuoUCVmG2Tatpsn0UBApBHezGRh0u1syWoGM8fiDvZmoYmhFe5FxKnftg3KNXhDf +Agk4OxwNNPBXpQFQP+GNxh6Qs7FEkYHLRh/J7vC0+wp3UWECQQDzcTQZXqYPow5M +uinL819HKfh1n2257w1HGvw8cMCiYbKRyR74Q18TJcxuEyEwnPrg5ZGpMPDKiIOU +SlgAMLBXAkEA3oxBpRue1Kqb2+Fq6lhZ7PQiZC5F69upIb/wxbk8ByImEl1pUKFW +rV+YoKujbnj77PmMq1+R0dFkT1ai3zDzsQJBAMa3CUgMMpFhEDMhYyzQJF36rI2W +7gJwV+5K4MqVXyktho3qFhWhKOKAYDcZ9mWwPjmGKzhocqVgecd6SAsfs1ECQA7r +xHL3eRy1G6IQaQSxS8YxUCT7XUDFB3/1yITZOIcZ6QeOL8NyLceOA0OyflCn1+w5 +hw7uZ25z5Y/UNTNVquECQEgto3zPneEW06qkEnRz9EbLtWR3nRBS/QGrjOFNUuln +pNhVUH4RB17Kk35xveUTz4U/Iw/WRfGNjFLHrtR/5xk= +-----END RSA PRIVATE KEY-----