Nethermind.Libp2p.Protocols.Tls 1.1.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Nethermind.Libp2p.Protocols.Tls --version 1.1.3
                    
NuGet\Install-Package Nethermind.Libp2p.Protocols.Tls -Version 1.1.3
                    
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="Nethermind.Libp2p.Protocols.Tls" Version="1.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nethermind.Libp2p.Protocols.Tls" Version="1.1.3" />
                    
Directory.Packages.props
<PackageReference Include="Nethermind.Libp2p.Protocols.Tls" />
                    
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 Nethermind.Libp2p.Protocols.Tls --version 1.1.3
                    
#r "nuget: Nethermind.Libp2p.Protocols.Tls, 1.1.3"
                    
#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 Nethermind.Libp2p.Protocols.Tls@1.1.3
                    
#: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=Nethermind.Libp2p.Protocols.Tls&version=1.1.3
                    
Install as a Cake Addin
#tool nuget:?package=Nethermind.Libp2p.Protocols.Tls&version=1.1.3
                    
Install as a Cake Tool

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.0 as 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:

  1. Certificate Generation: Creates ephemeral certificates with libp2p identity embedded
  2. Handshake: Performs TLS 1.3 handshake with ALPN "libp2p" protocol
  3. Peer Verification: Validates remote peer certificates against expected peer ID
  4. 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

  1. Export certificate's public key as SubjectPublicKeyInfo
  2. Concatenate "libp2p-tls-handshake:" prefix with the key info
  3. Sign the result using the peer's private identity key
  4. Embed signature in the libp2p extension

Platform Support

  • Platform Validation: Linux transport tests pass. Recorded validation of revision 84e0e2237eb5c8ce88ba59b747950f6a7cd2aa52 on 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 CertificateFromIdentity should 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 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.

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
Loading failed