SecureGrpc 1.0.0
dotnet add package SecureGrpc --version 1.0.0
NuGet\Install-Package SecureGrpc -Version 1.0.0
<PackageReference Include="SecureGrpc" Version="1.0.0" />
<PackageVersion Include="SecureGrpc" Version="1.0.0" />
<PackageReference Include="SecureGrpc" />
paket add SecureGrpc --version 1.0.0
#r "nuget: SecureGrpc, 1.0.0"
#:package SecureGrpc@1.0.0
#addin nuget:?package=SecureGrpc&version=1.0.0
#tool nuget:?package=SecureGrpc&version=1.0.0
SecureGrpc 🔐
✅ SECURITY UPDATE: This library has been migrated from the vulnerable Grpc.Core to the secure Grpc.Net.Client 2.65.0. All known vulnerabilities (CVE-2023-32731, CVE-2023-33953) have been fixed!
Post-quantum secure gRPC communication made ridiculously easy!
SecureGrpc provides transparent end-to-end encryption for gRPC using state-of-the-art cryptography:
- 🛡️ ML-KEM (Kyber-768) - Post-quantum secure key encapsulation
- 🔑 Diffie-Hellman - Classic perfect forward secrecy
- 🔒 AES-256-GCM - Authenticated encryption
Installation
dotnet add package SecureGrpc
Quick Start
Server
using SecureGrpc;
// One line to create a secure server!
using var server = Secure.Server(5001)
.OnMessage(data => {
Console.WriteLine($"Received: {Encoding.UTF8.GetString(data)}");
return Encoding.UTF8.GetBytes("Hello from server!");
})
.Start();
Client
using SecureGrpc;
// One line to create a secure client!
using var client = Secure.Client("localhost", 5001);
// Send messages - automatically encrypted!
var response = await client.SendAsync("Hello server!");
Console.WriteLine($"Server said: {response}");
Middleware Integration
Add encryption to existing gRPC services
// Server-side (using ASP.NET Core)
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGrpc()
.AddSecureGrpc(); // Add this line!
builder.Services.AddSingleton<YourServiceImpl>();
var app = builder.Build();
app.MapGrpcService<YourServiceImpl>();
app.Run();
// Client-side
var channel = GrpcChannel.ForAddress("https://localhost:5001")
.WithEncryption(); // Add this line!
var client = new YourService.YourServiceClient(channel);
Fluent API
var channel = "localhost".CreateSecureChannel(5001)
.WithHttpClient()
.Build();
Features
✅ No Security Vulnerabilities - Using secure Grpc.Net.Client 2.65.0
✅ Zero Configuration - Works out of the box
✅ Post-Quantum Secure - Resistant to quantum computer attacks
✅ Perfect Forward Secrecy - Past sessions remain secure
✅ Automatic Key Management - No manual key handling
✅ Session Management - Automatic session creation and reuse
✅ Cross-Language Compatible - Implement the protocol in any language
How It Works
- Automatic Key Exchange: Client and server automatically perform a hybrid key exchange using both ML-KEM and Diffie-Hellman
- Session Establishment: A secure session is created with a unique shared secret
- Transparent Encryption: All messages are automatically encrypted with AES-256-GCM
- Zero Trust: Each session uses unique keys derived from the shared secret
Performance
- Key Exchange: ~50ms (one-time per session)
- Encryption/Decryption: <1ms per message
- Memory Overhead: ~10KB per session
Security Details
Cryptographic Algorithms
- Key Exchange: ML-KEM-768 (Kyber) + DH-2048
- Encryption: AES-256-GCM with 128-bit tags
- Key Derivation: HMAC-SHA256
- Random: Cryptographically secure RNG
Threat Model
SecureGrpc protects against:
- 🔍 Eavesdropping (including by quantum computers)
- 🔄 Man-in-the-middle attacks (with proper certificate validation)
- 📝 Message tampering
- 🔙 Replay attacks
Advanced Usage
Custom Message Handlers
var server = Secure.Server(5001)
.OnMessage(async data => {
// Async processing
await ProcessDataAsync(data);
return responseData;
})
.Start();
Multiple Clients
var client1 = Secure.Client("server1", 5001);
var client2 = Secure.Client("server2", 5002);
// Each client maintains its own secure session
await Task.WhenAll(
client1.SendAsync("Hello server 1"),
client2.SendAsync("Hello server 2")
);
Testing
# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
License
MIT License - see LICENSE for details.
Acknowledgments
- BouncyCastle for cryptographic implementations
- gRPC for the RPC framework
- NIST for standardizing ML-KEM
Made with ❤️ for developers who care about security
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net9.0
- BouncyCastle.Cryptography (>= 2.4.0)
- Google.Protobuf (>= 3.28.3)
- Grpc.Core.Api (>= 2.65.0)
- Grpc.Net.Client (>= 2.65.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 |
---|---|---|
1.0.0 | 78 | 8/3/2025 |