NTDLS.SecureKeyExchange 2.2.1

dotnet add package NTDLS.SecureKeyExchange --version 2.2.1
NuGet\Install-Package NTDLS.SecureKeyExchange -Version 2.2.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.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NTDLS.SecureKeyExchange --version 2.2.1
#r "nuget: NTDLS.SecureKeyExchange, 2.2.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.2.1

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

NTDLS.SecureKeyExchange

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

Be sure to check out the NuGet pacakge: https://www.nuget.org/packages/NTDLS.SecureKeyExchange

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}");

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  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 is compatible.  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.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.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
2.2.1 219 11/15/2023
2.2.0 117 11/2/2023
2.1.0 122 10/12/2023
2.0.2 112 10/10/2023
2.0.1 320 11/19/2022
2.0.0 317 11/19/2022
1.0.0 315 11/18/2022

net8