updated readme & sni function

This commit is contained in:
gasbytes
2024-06-04 17:54:21 +02:00
parent b2e7707f18
commit 5d0b7e0d18
3 changed files with 49 additions and 30 deletions

View File

@@ -30,7 +30,7 @@ apt-get upgrade
apt-get install mono-complete apt-get install mono-complete
``` ```
# Build wolfSSL and install ### Build wolfSSL and install
``` ```
./autogen.sh ./autogen.sh
@@ -40,24 +40,42 @@ make check
sudo make install sudo make install
``` ```
# Build and run the wrapper ### Build and run the wrapper
``` ```
cd wrapper/CSharp cd wrapper/CSharp
```
Building the server:
```
mcs wolfSSL_CSharp/wolfSSL.cs wolfSSL_CSharp/X509.cs \ mcs wolfSSL_CSharp/wolfSSL.cs wolfSSL_CSharp/X509.cs \
wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs && \
cp wolfSSL_CSharp/wolfSSL.exe ../../certs/server.exe
``` ```
# Run the example Building the 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
```
### Run the example
In one terminal instance run:
``` ```
cp wolfSSL_CSharp/wolfSSL.exe ../../certs
cd ../../certs cd ../../certs
mono wolfSSL.exe mono server.exe
```
Calling ctx Init from wolfSSL
Finished init of ctx .... now load in cert and key And in another terminal instance run:
Ciphers : TLS13-AES128-GCM-SHA256:TLS13-AES256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305-OLD:ECDHE-ECDSA-CHACHA20-POLY1305-OLD:DHE-RSA-CHACHA20-POLY1305-OLD ```
Started TCP and waiting for a connection cd ../../certs
mono client.exe
```
### Enabling SNI
To enable SNI, just pass the `-S` argument with the specified hostname:
```
mono client.exe -S hostname
``` ```

View File

@@ -67,18 +67,19 @@ public class wolfSSL_TLS_Client
/// </summary> /// </summary>
private static bool haveSNI(string[] args) private static bool haveSNI(string[] args)
{ {
if (args != null && args.Length == 2 && args[0] == "-S") bool sniON = false;
{ for (int i = 0; i < args.Length; i++) {
Console.WriteLine("SNI IS: ON"); if (args[i] == "-S") {
return true; sniON = true;
} break;
else { }
Console.WriteLine("SNI IS: OFF");
return false;
} }
Console.WriteLine("SNI IS: " + sniON);
return sniON;
} }
public static void Main(string[] args) public static void Main(string[] args)
{ {
IntPtr ctx; IntPtr ctx;

View File

@@ -55,15 +55,15 @@ public class wolfSSL_TLS_CSHarp
/// </summary> /// </summary>
private static bool haveSNI(string[] args) private static bool haveSNI(string[] args)
{ {
if (args != null && args.Length == 2 && args[0] == "-S") bool sniON = false;
{ for (int i = 0; i < args.Length; i++) {
Console.WriteLine("SNI IS: ON"); if (args[i] == "-S") {
return true; sniON = true;
} break;
else { }
Console.WriteLine("SNI IS: OFF");
return false;
} }
Console.WriteLine("SNI IS: " + sniON);
return sniON;
} }
/// <summary> /// <summary>