Daniel Pouzzner 996986d0c1 refactor wc_AesDelete, wc_curve25519_delete, wc_ed25519_delete, wc_HashDelete, and wc_DeleteRsaKey to take two arguments, the first a required pointer to the object, the second an optional pointer to the pointer to be zeroed upon successful deletion, for the benefit of calling from C# without unsafe code. 3 days ago
..
wolfCrypt-Test e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL-DTLS-PSK-Server e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL-DTLS-Server e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL-Example-IOCallbacks e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL-TLS-Client e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL-TLS-PSK-Client e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL-TLS-PSK-Server e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL-TLS-Server e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL-TLS-ServerThreaded e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL_CSharp 996986d0c1 refactor wc_AesDelete, wc_curve25519_delete, wc_ed25519_delete, wc_HashDelete, and wc_DeleteRsaKey to take two arguments, the first a required pointer to the object, the second an optional pointer to the pointer to be zeroed upon successful deletion, for the benefit of calling from C# without unsafe code. 3 days ago
README.md e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
include.am e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
user_settings.h e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfSSL_CSharp.sln e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago
wolfssl.vcxproj e10c943bf3 wolfCrypt CSharp Wrapper: 2 weeks ago

README.md

wolfSSL CSharp Wrappers

This directory contains the CSharp wrapper for the wolfSSL TLS layer with examples.

  • wolfSSL_CSharp: wolfSSL TLS layer wrappers (library).
  • wolfCrypt-Test: wolfCrypt layer wrapper testing.
  • user_settings.h: wolfCrypt wrapper user settings.

Examples:

  • wolfSSL-DTLS-PSK-Server
  • wolfSSL-DTLS-Server
  • wolfSSL-Example-IOCallbacks
  • wolfSSL-TLS-Client
  • wolfSSL-TLS-PSK-Client
  • wolfSSL-TLS-PSK-Server
  • wolfSSL-TLS-Server
  • wolfSSL-TLS-ServerThreaded

Windows

A Visual Studio solution wolfSSL_CSharp.sln is provided. This will allow you to build the wrapper library and examples. It includes the wolfSSL Visual Studio project directly.

To successfully run and build the solution on Windows Visual Studio you will need to open a new solution wolfSSL_CSharp.sln located in wrapper\CSharp\wolfSSL_CSharp.sln.

Select the CPU type, configuration, and target file. select Build and either Rebuild Solution or Build Solution.

Linux (Ubuntu) using mono

Prerequisites for linux:

apt-get update
apt-get upgrade
apt-get install mono-complete

Build wolfSSL and install

./autogen.sh
./configure --enable-keygen --enable-eccencrypt --enable-ed25519 --enable-curve25519 --enable-aesgcm
make
make check
sudo make install

Build and run the wolfCrypt test wrapper

From the wrapper/CSharp directory (cd wrapper/CSharp):

Compile wolfCrypt test:

mcs wolfCrypt-Test/wolfCrypt-Test.cs wolfSSL_CSharp/wolfCrypt.cs -OUT:wolfcrypttest.exe
mono wolfcrypttest.exe

Build and run the wolfSSL client/server test

From the wrapper/CSharp directory (cd wrapper/CSharp):

Compile server:

mcs wolfSSL_CSharp/wolfSSL.cs wolfSSL_CSharp/X509.cs wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs -OUT:server.exe

Compile client:

mcs wolfSSL_CSharp/wolfSSL.cs wolfSSL_CSharp/X509.cs wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs -OUT:client.exe

Run the example

In one terminal instance run the server:

mono server.exe

And in another terminal instance run the client:

mono client.exe

Enabling SNI

To enable SNI, just pass the -S argument with the specified hostname to the client:

mono client.exe -S hostname

And run the server with the -S flag:

mono server.exe -S