Nethermind.Libp2p.Protocols.Tls
1.1.4
See the version list below for details.
dotnet add package Nethermind.Libp2p.Protocols.Tls --version 1.1.4
NuGet\Install-Package Nethermind.Libp2p.Protocols.Tls -Version 1.1.4
<PackageReference Include="Nethermind.Libp2p.Protocols.Tls" Version="1.1.4" />
<PackageVersion Include="Nethermind.Libp2p.Protocols.Tls" Version="1.1.4" />
<PackageReference Include="Nethermind.Libp2p.Protocols.Tls" />
paket add Nethermind.Libp2p.Protocols.Tls --version 1.1.4
#r "nuget: Nethermind.Libp2p.Protocols.Tls, 1.1.4"
#:package Nethermind.Libp2p.Protocols.Tls@1.1.4
#addin nuget:?package=Nethermind.Libp2p.Protocols.Tls&version=1.1.4
#tool nuget:?package=Nethermind.Libp2p.Protocols.Tls&version=1.1.4
TLS Protocol
This implementation supports the libp2p TLS handshake protocol described in the libp2p TLS specification, with the received certificate-list limitation described below.
Features
Protocol Compliance
- TLS 1.3 Enforcement: Only TLS 1.3 (and higher) is supported per libp2p spec
- Protocol ID:
/tls/1.0.0as defined in the specification - ALPN: Uses "libp2p" application protocol for negotiation
- Peer Authentication: Mutual TLS with libp2p public key extension
Certificate Features
- libp2p Extension: Custom X.509 extension (OID:
1.3.6.1.4.1.53594.1.1) for peer identity - Self-Signed Certificates: Uses session keys for certificate signing, separate from host identity keys
- Key Type Support: Ed25519, Secp256k1, ECDSA, and RSA key types
- Session Keys: Certificates use the supplied session key outside Windows and a shared process-owned P-256 key on Windows. Each certificate owns its private-key handle.
Security Features
- Certificate Validation: Comprehensive validation per libp2p spec:
- Certificate validity period checking
- Self-signed certificate requirement
- libp2p extension presence verification
- Peer ID matching
- Cryptographic signature verification
- Client Authentication: Required mutual authentication
- Signature Verification: Verifies signature over "libp2p-tls-handshake:" prefix + certificate public key
Usage
The TLS protocol is automatically integrated into the libp2p connection stack. It handles:
- Certificate Generation: Creates ephemeral certificates with libp2p identity embedded
- Handshake: Performs TLS 1.3 handshake with ALPN "libp2p" protocol
- Peer Verification: Validates remote peer certificates against expected peer ID
- Secure Channel: Establishes encrypted communication channel
Implementation Details
Certificate Structure
X.509 Certificate:
├── Subject: SERIALNUMBER=<random-hex>
├── Issuer: Same as Subject (self-signed)
├── Public Key: Session ECDSA key
├── Extensions:
│ └── libp2p Public Key Extension (1.3.6.1.4.1.53594.1.1):
│ └── SignedKey (ASN.1):
│ ├── publicKey: libp2p peer identity public key (protobuf)
│ └── signature: Signature over "libp2p-tls-handshake:" + cert public key
└── Validity: 1 day before creation to far future
Signature Process
- Export certificate's public key as
SubjectPublicKeyInfo - Concatenate "libp2p-tls-handshake:" prefix with the key info
- Sign the result using the peer's private identity key
- Embed signature in the libp2p extension
Platform Support
- Platform Validation: Linux transport tests pass. Recorded validation of revision
84e0e2237eb5c8ce88ba59b747950f6a7cd2aa52on Windows 10.0.26200 / .NET 10.0.12 passed QUIC 32/32, TLS 32/32, and registered transport/alias controls 5/5 without skips. The validation record links a portable results snapshot, replay commands, and the CI artifact configuration; all CI gates remain. - Windows Keys: Schannel requires a named CNG key. Certificates share one process-owned key, with certificate creation serialized and deletion of that exact key attempted at normal process exit. Disposing a certificate does not delete the shared key; callers of
CertificateFromIdentityshould dispose the certificate and must not explicitly delete its private key. - Crash Lifetime: Fresh Windows key initialization attempts recovery of exactly marked process keys after proving their owning process incarnation has terminated. Live owners, unknown liveness and unmarked legacy keys are retained. Contention, access restrictions and deletion failure defer recovery to another initialization. See the recovery contract and validation status.
Received certificate lists
The specification requires rejecting more than one transmitted certificate. The current validation verifies the leaf's self-signature and identity but does not enforce the transmitted list's cardinality. SslStream exposes a platform-built X509Chain, which can have one element even when the peer sent an unrelated certificate or a duplicate leaf. ChainElements.Count == 1 therefore cannot enforce this requirement. On the tested Windows runtime, a duplicate leaf is also absent from ExtraStore in both roles: the callback exposes only the presented leaf, one chain element, and an empty ExtraStore, as in the valid single-certificate control. #373 remains unresolved. See the probe and platform evidence.
Testing
The implementation includes comprehensive test coverage:
- Basic certificate generation and validation
- Network-level TLS handshake testing
- Bidirectional data exchange validation
- libp2p specification compliance tests
- Error condition handling
Run tests with:
dotnet test Libp2p.Protocols.Tls.Tests
References
| 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. |
-
net10.0
- Microsoft.Extensions.Logging (>= 10.0.0)
- Nethermind.Libp2p.Core (>= 1.1.4)
- Nethermind.Libp2p.Protocols.Quic (>= 1.1.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Nethermind.Libp2p.Protocols.Tls:
| Package | Downloads |
|---|---|
|
Nethermind.Libp2p
A libp2p implementation for .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.1 | 130 | 11/22/2026 |
| 1.2.0 | 37,332 | 11/16/2026 |
| 1.1.4 | 149 | 11/15/2026 |
| 1.1.3 | 119 | 11/15/2026 |
| 1.1.2 | 112 | 11/15/2026 |
| 1.1.1 | 146 | 11/2/2026 |
| 1.1.0 | 2,641 | 10/20/2026 |
| 1.0.5 | 126 | 10/19/2026 |
| 1.0.4 | 134 | 10/15/2026 |
| 1.0.3 | 328 | 10/6/2026 |
| 1.0.2 | 129 | 10/3/2026 |
| 1.0.1 | 128 | 10/2/2026 |
| 1.0.0 | 141 | 10/1/2026 |
| 1.0.0-preview.51 | 6,697 | 11/11/2025 |
| 1.0.0-preview.50 | 167 | 11/7/2025 |
| 1.0.0-preview.49 | 214 | 11/6/2025 |
| 1.0.0-preview.48 | 222 | 11/6/2025 |
| 1.0.0-preview.45 | 2,091,790 | 5/13/2025 |
| 1.0.0-preview.44 | 1,158 | 5/9/2025 |
| 1.0.0-preview.43 | 199 | 5/9/2025 |