- Platform specific function to correctly set the path for the certificates;
- Updated all the examples with it;
This commit is contained in:
@@ -116,9 +116,14 @@ public class wolfSSL_TLS_ServerThreaded
|
||||
IntPtr ctx;
|
||||
|
||||
/* These paths should be changed for use */
|
||||
string fileCert = @"server-cert.pem";
|
||||
string fileKey = @"server-key.pem";
|
||||
StringBuilder dhparam = new StringBuilder("dh2048.pem");
|
||||
string fileCert = wolfssl.setPath("server-cert.pem");
|
||||
string fileKey = wolfssl.setPath("server-key.pem");
|
||||
StringBuilder dhparam = new StringBuilder(wolfssl.setPath("dh2048.pem"));
|
||||
|
||||
if (fileCert == "" || fileKey == "" || dhparam.Length == 0) {
|
||||
Console.WriteLine("Platform not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
/* example of function used for setting logging */
|
||||
wolfssl.SetLogging(standard_log);
|
||||
@@ -140,6 +145,12 @@ public class wolfSSL_TLS_ServerThreaded
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(dhparam.ToString())) {
|
||||
Console.WriteLine("Could not find dh file");
|
||||
wolfssl.CTX_free(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (wolfssl.CTX_use_certificate_file(ctx, fileCert, wolfssl.SSL_FILETYPE_PEM) != wolfssl.SUCCESS)
|
||||
{
|
||||
Console.WriteLine("Error in setting cert file");
|
||||
|
||||
Reference in New Issue
Block a user