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
<PackageReference Include="OutWit.Communication.Server.Encryption.BouncyCastle" Version="2.3.0" />
<PackageVersion Include="OutWit.Communication.Server.Encryption.BouncyCastle" Version="2.3.0" />
<PackageReference Include="OutWit.Communication.Server.Encryption.BouncyCastle" />
paket add OutWit.Communication.Server.Encryption.BouncyCastle --version 2.3.0
#r "nuget: OutWit.Communication.Server.Encryption.BouncyCastle, 2.3.0"
#:package OutWit.Communication.Server.Encryption.BouncyCastle@2.3.0
#addin nuget:?package=OutWit.Communication.Server.Encryption.BouncyCastle&version=2.3.0
#tool nuget:?package=OutWit.Communication.Server.Encryption.BouncyCastle&version=2.3.0
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
Basic Usage (Recommended)
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 | Versions 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. |
-
net10.0
- BouncyCastle.Cryptography (>= 2.6.2)
- OutWit.Communication (>= 2.3.0)
- OutWit.Communication.Server (>= 2.3.0)
-
net6.0
- BouncyCastle.Cryptography (>= 2.6.2)
- OutWit.Communication (>= 2.3.0)
- OutWit.Communication.Server (>= 2.3.0)
-
net7.0
- BouncyCastle.Cryptography (>= 2.6.2)
- OutWit.Communication (>= 2.3.0)
- OutWit.Communication.Server (>= 2.3.0)
-
net8.0
- BouncyCastle.Cryptography (>= 2.6.2)
- OutWit.Communication (>= 2.3.0)
- OutWit.Communication.Server (>= 2.3.0)
-
net9.0
- BouncyCastle.Cryptography (>= 2.6.2)
- OutWit.Communication (>= 2.3.0)
- OutWit.Communication.Server (>= 2.3.0)
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 |