NTDLS.SecureKeyExchange 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package NTDLS.SecureKeyExchange --version 2.0.1                
NuGet\Install-Package NTDLS.SecureKeyExchange -Version 2.0.1                
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="NTDLS.SecureKeyExchange" Version="2.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NTDLS.SecureKeyExchange --version 2.0.1                
#r "nuget: NTDLS.SecureKeyExchange, 2.0.1"                
#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.
// Install NTDLS.SecureKeyExchange as a Cake Addin
#addin nuget:?package=NTDLS.SecureKeyExchange&version=2.0.1

// Install NTDLS.SecureKeyExchange as a Cake Tool
#tool nuget:?package=NTDLS.SecureKeyExchange&version=2.0.1                

NTDLS.SecureKeyExchange

Easily generate a shared diffie-hellman key in C++ or C#.

Scenerio (use your imagination):

  • localHost is a local service.
  • remotePeer is a remote peer.
//localHost starts the process with a call to GenerateNegotiationToken(),
//  specifying the size of the key (which is actually n*12).
var localHost = new CompoundNegotiator();
byte[] negotiationToken = localHost.GenerateNegotiationToken(8);

//localHost passes the resulting bytes from GenerateNegotiationToken()
//  to a remote peer which passes the bytes to ApplyNegotiationToken().
var remotePeer = new CompoundNegotiator();
byte[] negotiationReply = remotePeer.ApplyNegotiationToken(negotiationToken);

//The remotePeer passes the bytes from ApplyNegotiationToken() back to the 
//  localHost, where the localHost passes them to ApplyNegotiationResponseToken()
localHost.ApplyNegotiationResponseToken(negotiationReply);

//At this point, both the localHost and the remotePeer have the same bytes in
//  "SharedSecret" as we can see from comparing the "SharedSecretHash".
if (remotePeer.SharedSecretHash != localHost.SharedSecretHash)
{
    throw new Exception("This should never happen.");
}

Console.WriteLine($"Key length: {localHost.KeyLength} bytes.");
Console.WriteLine($" Local Shared Secret: {localHost.SharedSecretHash}");
Console.WriteLine($"Remote Shared Secret: {remotePeer.SharedSecretHash}");
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.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.

Version Downloads Last updated
3.0.1 119 6/22/2024
3.0.0 100 6/22/2024
2.2.2 87 6/12/2024
2.2.1 268 11/15/2023
2.2.0 148 11/2/2023
2.1.0 151 10/12/2023
2.0.2 140 10/10/2023
2.0.1 357 11/19/2022
2.0.0 349 11/19/2022
1.0.0 349 11/18/2022

Migrated to net7, added image.