Skip to content

Commit

Permalink
made the workflow to compile & executes easier, updated the readme also
Browse files Browse the repository at this point in the history
  • Loading branch information
gasbytes committed Jun 4, 2024
1 parent 983610e commit 70fc5c9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
24 changes: 14 additions & 10 deletions wrapper/CSharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,44 @@ sudo make install

### Build and run the wrapper

From the wolfssl root directory:

```
cd wrapper/CSharp
```

Building the server:
Compile server:

```
mcs wolfSSL_CSharp/wolfSSL.cs wolfSSL_CSharp/X509.cs \
wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs && \
cp wolfSSL_CSharp/wolfSSL.exe ../../certs/server.exe
wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs -OUT:server.exe
```

Building the client:
Compile client:

```
mcs wolfSSL_CSharp/wolfSSL.cs wolfSSL_CSharp/X509.cs \
wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs && \
cp wolfSSL_CSharp/wolfSSL.exe ../../certs/client.exe
wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs -OUT:client.exe
```

### Run the example

In one terminal instance run:
In one terminal instance run the server:

```
cd ../../certs
mono server.exe
```

And in another terminal instance run:
And in another terminal instance run the client:

```
cd ../../certs
mono client.exe
```

### Enabling SNI

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

```
mono client.exe -S hostname
```
2 changes: 1 addition & 1 deletion wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void Main(string[] args)
IntPtr sniHostName;

/* These paths should be changed for use */
string caCert = @"ca-cert.pem";
string caCert = @"../../certs/ca-cert.pem";
StringBuilder dhparam = new StringBuilder("dh2048.pem");

StringBuilder buff = new StringBuilder(1024);
Expand Down
4 changes: 2 additions & 2 deletions wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public static void Main(string[] args)
IntPtr arg_sni;

/* These paths should be changed for use */
string fileCert = @"server-cert.pem";
string fileKey = @"server-key.pem";
string fileCert = @"../../certs/server-cert.pem";
string fileKey = @"../../certs/server-key.pem";
StringBuilder dhparam = new StringBuilder("dh2048.pem");

StringBuilder buff = new StringBuilder(1024);
Expand Down

0 comments on commit 70fc5c9

Please sign in to comment.