Dp9ik 0.4.2

dotnet add package Dp9ik --version 0.4.2
                    
NuGet\Install-Package Dp9ik -Version 0.4.2
                    
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="Dp9ik" Version="0.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dp9ik" Version="0.4.2" />
                    
Directory.Packages.props
<PackageReference Include="Dp9ik" />
                    
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 Dp9ik --version 0.4.2
                    
#r "nuget: Dp9ik, 0.4.2"
                    
#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 Dp9ik@0.4.2
                    
#: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=Dp9ik&version=0.4.2
                    
Install as a Cake Addin
#tool nuget:?package=Dp9ik&version=0.4.2
                    
Install as a Cake Tool

dp9ik.net

9front's dp9ik authentication for .NET, in managed code.

Package Contents
Dp9ik passtokey, AuthPAK (SPAKE2-EE over Ed448-Goldilocks with Decaf and Elligator 2), form 1 (ChaCha20-Poly1305) and form 0 (DES) tickets and authenticators, ticket requests, and the dp9ik session secret
Dp9ik.P9Auth Both sides of the p9any/dp9ik exchange over a Stream: the server's, and the client's, which gets its tickets from the domain's auth server as drawterm does
Dp9ik.Tls TLS 1.2 PSK keyed by the session secret, as tlssrv and tlsclient -a use it

The cryptography uses BouncyCastle. No native code, OpenSSL or helper processes are involved.

Compatibility

Message formats and key derivations follow 9front libauthsrv (passtokey.c, authpak.c, form1.c, convT2M.c, convM2T.c, convM2TR.c, _asrdresp.c, _asgetticket.c) and factotum's dp9ik session secret; the client follows drawterm's p9any in cpu.c, dp9ik only. The tests compare every primitive with a reference built from drawterm's libauthsrv.

As in 9front:

  • user names hold at most 27 bytes and the auth domain 47, leaving room for the C terminator (ANAMELEN, DOMLEN);
  • received tickets and ticket requests have their names terminated;
  • a dp9ik server refuses form 0 tickets;
  • the TLS channel offers only TLS_PSK_WITH_CHACHA20_POLY1305_SHA256, TLS_PSK_WITH_AES_128_CBC_SHA256 and TLS_PSK_WITH_AES_128_CBC_SHA with PSK identity p9secret.

Use

Authenticate a client on a server whose key is registered with the auth server for its domain, then open the encrypted channel:

using Dp9ik.P9Auth;
using Dp9ik.Tls;

var config = new AuthServerConfig(Domain: "example.org", User: "bootes", Password: serverPassword);
P9AuthResult result = await P9AuthProtocol.AuthenticateAsync(stream, config, cancellationToken);
Stream channel = await P9PskTls.AcceptAsync(stream, result.Secret, cancellationToken);
// result.User is the authenticated client user.

Authenticate to such a server as a user, getting the tickets from the auth server, and open the channel from the client's side:

var config = new P9AuthClientConfig(
    User: "glenda",
    Password: (prompt, _) => ValueTask.FromResult<string?>(ReadPassword(prompt.Text)),
    DialAuthServer: async (domain, token) => await DialAsync("auth.example.org", 567, token));
P9AuthClientResult result = await P9AuthClient.AuthenticateAsync(stream, config, cancellationToken);
Stream channel = await P9PskTls.ConnectAsync(stream, result.Secret, cancellationToken);

The password is asked for again, with prompt.Mismatch set, when the auth server's ticket does not open with it; returning null ends the client. When the auth server cannot be had, a user who is the server's own authid makes the tickets itself, as drawterm's mkservertickets does.

License

MIT. See LICENSE.

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 Dp9ik:

Package Downloads
Dp9ik.P9Auth

Both sides of the 9front p9any/dp9ik authentication exchange over a stream: the server, returning the authenticated user, and the client, getting its tickets from the auth server; each returns the session secret.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.2 131 11/11/2026
0.4.1 135 11/1/2026
0.3.0 167 10/2/2026
0.2.0 129 10/2/2026
0.1.0 128 10/1/2026