OutWit.Communication.Server.Encryption.BouncyCastle 2.3.0

dotnet add package OutWit.Communication.Server.Encryption.BouncyCastle --version 2.3.0
                    
NuGet\Install-Package OutWit.Communication.Server.Encryption.BouncyCastle -Version 2.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OutWit.Communication.Server.Encryption.BouncyCastle" Version="2.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OutWit.Communication.Server.Encryption.BouncyCastle" Version="2.3.0" />
                    
Directory.Packages.props
<PackageReference Include="OutWit.Communication.Server.Encryption.BouncyCastle" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OutWit.Communication.Server.Encryption.BouncyCastle --version 2.3.0
                    
#r "nuget: OutWit.Communication.Server.Encryption.BouncyCastle, 2.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OutWit.Communication.Server.Encryption.BouncyCastle@2.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OutWit.Communication.Server.Encryption.BouncyCastle&version=2.3.0
                    
Install as a Cake Addin
#tool nuget:?package=OutWit.Communication.Server.Encryption.BouncyCastle&version=2.3.0
                    
Install as a Cake Tool

OutWit.Communication.Server.Encryption.BouncyCastle

Cross-platform BouncyCastle-based encryption for WitRPC server, providing RSA/AES encryption compatible with BouncyCastle clients.

Overview

OutWit.Communication.Server.Encryption.BouncyCastle provides a cross-platform encryption implementation for WitRPC servers using the BouncyCastle cryptography library. This package is required when your clients use BouncyCastle encryption (e.g., Blazor WebAssembly clients).

The encryption uses RSA-OAEP (with SHA-256) for secure key exchange and AES-CBC for symmetric message encryption, providing end-to-end encryption for WitRPC communication.

Installation

Install-Package OutWit.Communication.Server.Encryption.BouncyCastle

Usage

Use the extension method for the simplest setup:

using OutWit.Communication.Server;
using OutWit.Communication.Server.Encryption.BouncyCastle;

var server = WitServerBuilder.Build(options =>
{
    options.WithWebSocket("http://localhost:5000", maxClients: 100);
    options.WithJson();
    options.WithBouncyCastleEncryption();  // Simple extension method
    options.WithService(myService);
});

server.StartWaitingForConnection();
With Dependency Injection
services.AddSingleton<IEncryptorServerFactory, EncryptorServerBouncyCastleFactory>();

services.AddWitRpcServer("my-server", (options, sp) =>
{
    var encryptorFactory = sp.GetRequiredService<IEncryptorServerFactory>();
    
    options.WithTcp(5000, maxClients: 50);
    options.WithJson();
    options.WithEncryptor(encryptorFactory);
    options.WithService<IMyService>(sp.GetRequiredService<IMyService>());
});

?? Important: Client Compatibility

BouncyCastle encryption is NOT compatible with standard .NET encryption.

When using WithBouncyCastleEncryption() on the server, your clients must also use WithBouncyCastleEncryption():

// Client configuration (required!)
var client = WitClientBuilder.Build(options =>
{
    options.WithWebSocket("ws://localhost:5000");
    options.WithJson();
    options.WithBouncyCastleEncryption();  // Must match server!
});
Server Encryption Client Encryption Compatible?
WithBouncyCastleEncryption() WithBouncyCastleEncryption() ? Yes
WithBouncyCastleEncryption() WithEncryption() ? No
WithEncryption() WithEncryption() ? Yes
WithEncryption() WithBouncyCastleEncryption() ? No

Security Details

  • Key Exchange: RSA-OAEP with SHA-256
  • Symmetric Encryption: AES-256-CBC with PKCS7 padding
  • Key Generation: Secure random using BouncyCastle's SecureRandom

When to Use BouncyCastle

Use BouncyCastle encryption when:

  • Your clients include Blazor WebAssembly applications
  • You need cross-platform consistency across different .NET runtimes
  • You want to avoid platform-specific crypto implementations

Use standard encryption (WithEncryption()) when:

  • All clients run on standard .NET (Windows/Linux/macOS)
  • You don't have Blazor WebAssembly clients
  • You prefer using .NET's built-in cryptography

Further Documentation

For more about WitRPC encryption and cross-platform support, see the official documentation on witrpc.io.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.0 422 12/9/2025