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
```
# Build wolfSSL and install
### Build wolfSSL and install
```
./autogen.sh
@@ -40,24 +40,42 @@ make check
sudo make install
```
# Build and run the wrapper
### Build and run the wrapper
```
cd wrapper/CSharp
```
Building the server:
```
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
mono wolfSSL.exe
Calling ctx Init from wolfSSL
Finished init of ctx .... now load in cert and key
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
mono server.exe
```
And in another terminal instance run:
```
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

@@ -65,20 +65,21 @@ public class wolfSSL_TLS_Client
/// wolfSSL.
/// <param name="args">Parameters passed via command line</param>
/// </summary>
private static bool haveSNI(string[] args)
private static bool haveSNI(string[] args)
{
if (args != null && args.Length == 2 && args[0] == "-S")
{
Console.WriteLine("SNI IS: ON");
return true;
}
else {
Console.WriteLine("SNI IS: OFF");
return false;
bool sniON = false;
for (int i = 0; i < args.Length; i++) {
if (args[i] == "-S") {
sniON = true;
break;
}
}
Console.WriteLine("SNI IS: " + sniON);
return sniON;
}
public static void Main(string[] args)
{
IntPtr ctx;

View File

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