DTLS 0.2.0
dotnet add package DTLS --version 0.2.0
NuGet\Install-Package DTLS -Version 0.2.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="DTLS" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DTLS" Version="0.2.0" />
<PackageReference Include="DTLS" />
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 DTLS --version 0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DTLS, 0.2.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 DTLS@0.2.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=DTLS&version=0.2.0
#tool nuget:?package=DTLS&version=0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DTLS
High-performance DTLS (Datagram Transport Layer Security) library for .NET, powered by a native Rust backend.
- Sans-I/O design for maximum flexibility
- AOT compatible
- DTLS 1.2 / 1.3 support
Usage
Client
DtlsClientOptions options = new()
{
ServerName = "example.com",
RemoteCertificateValidation = (cert, chain, errors) => true,
};
await using DtlsTransport transport = await DtlsTransport.CreateClientAsync(udpTransport, options);
await transport.HandshakeAsync();
await transport.SendAsync(data);
int bytesRead = await transport.ReceiveAsync(buffer);
Server
DtlsServerOptions options = new()
{
Certificate = serverCert,
};
await using DtlsTransport transport = await DtlsTransport.CreateServerAsync(udpTransport, options);
await transport.HandshakeAsync();
int bytesRead = await transport.ReceiveAsync(buffer);
await transport.SendAsync(response);
API
IDatagramTransport
Low-level datagram transport abstraction that preserves message boundaries.
public interface IDatagramTransport
{
ValueTask<int> ReceiveAsync(Memory<byte> buffer, CancellationToken cancellationToken = default);
ValueTask SendAsync(ReadOnlyMemory<byte> datagram, CancellationToken cancellationToken = default);
}
DtlsTransport
Async I/O wrapper that bridges the sans-I/O protocol engine with an IDatagramTransport.
| Method | Description |
|---|---|
CreateClientAsync |
Create a DTLS client |
CreateServerAsync |
Create a DTLS server |
HandshakeAsync |
Perform DTLS handshake |
SendAsync |
Send encrypted datagram |
ReceiveAsync |
Receive decrypted datagram |
DtlsSession
Sans-I/O DTLS protocol engine for advanced scenarios.
| Method | Description |
|---|---|
CreateClient |
Create a client session |
CreateServer |
Create a server session |
Feed |
Feed received data into the engine |
HandleTimeout |
Handle retransmission timeout |
Send |
Encrypt plaintext into output |
TryReceive |
Try to read decrypted application data |
VerifyPeer |
Verify peer certificate |
Options
DtlsClientOptions — Client configuration:
| Property | Description |
|---|---|
ServerName |
Required. Server hostname for SNI |
ClientCertificate |
Optional client certificate |
RemoteCertificateValidation |
Custom certificate validation callback |
HandshakeTimeout |
Handshake timeout (default 15s) |
Version |
SSL/TLS protocol version |
DtlsServerOptions — Server configuration:
| Property | Description |
|---|---|
Certificate |
Required. Server certificate with private key |
RemoteCertificateValidation |
Custom certificate validation callback |
HandshakeTimeout |
Handshake timeout (default 15s) |
Version |
SSL/TLS protocol version |
RequireClientCertificate |
Whether to require client certificate |
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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.
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.