Nethermind.Libp2p.Protocols.Tls 1.0.4

dotnet add package Nethermind.Libp2p.Protocols.Tls --version 1.0.4
                    
NuGet\Install-Package Nethermind.Libp2p.Protocols.Tls -Version 1.0.4
                    
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.0.4" />
                    
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.0.4" />
                    
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.0.4
                    
#r "nuget: Nethermind.Libp2p.Protocols.Tls, 1.0.4"
                    
#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.0.4
                    
#: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.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Nethermind.Libp2p.Protocols.Tls&version=1.0.4
                    
Install as a Cake Tool

TLS Protocol

This implementation provides full support for the libp2p TLS handshake protocol as specified in the libp2p TLS specification.

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 ephemeral keys for certificate signing, not host keys
  • Key Type Support: Ed25519, Secp256k1, ECDSA, and RSA key types
  • Windows Compatibility: Special handling for Windows CNG key requirements

Security Features

  • Certificate Validation: Comprehensive validation per libp2p spec:
    • Certificate validity period checking
    • Self-signed certificate requirement
    • Single certificate (no chains allowed)
    • 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: Ephemeral 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

  • Cross-platform: Works on Linux, macOS, and Windows
  • Windows CNG: Special handling for Windows named CNG keys for SslStream compatibility
  • Key Generation: Creates persistent named keys on Windows, ephemeral keys elsewhere

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.0.4 47 10/15/2026
1.0.3 105 10/6/2026
1.0.2 100 10/3/2026
1.0.1 101 10/2/2026
1.0.0 112 10/1/2026
1.0.0-preview.51 6,165 11/11/2025
1.0.0-preview.50 155 11/7/2025
1.0.0-preview.49 206 11/6/2025
1.0.0-preview.48 214 11/6/2025
1.0.0-preview.45 1,934,290 5/13/2025
1.0.0-preview.44 1,139 5/9/2025
1.0.0-preview.43 187 5/9/2025
1.0.0-preview.37 192 2/18/2025
1.0.0-preview.36 46,093 2/10/2025
1.0.0-preview.35 181 2/10/2025
1.0.0-preview.34 50,424 10/24/2024