clients::rdp connects over any caller-dialled TCP stream (direct, proxy or SSH tunnel), upgrades to TLS and logs on with NLA (CredSSP/NTLM), optionally falling back to TLS-only logon for servers without NLA such as xrdp (credentials are passed so they log straight in). The server certificate is pinned through a caller check on its SHA256 fingerprint before any credentials are sent. The desktop decodes into the VNC client's RGBA framebuffer; input (IronRDP's scancode/Unicode/mouse operations), Display Control resizes and the deactivation-reactivation sequence run on the session thread. IronRDP's releases need three vendored patches (vendor/README.md): picky and sspi with their RustCrypto release-candidate pins relaxed so they share russh's stable versions (their own suites, 402 tests, pass against them), and ironrdp-session with two unreleased upstream bitmap fixes (#1486 stride, #1524 RDP6 orientation) without which xrdp desktops render sheared. Verified live against xrdp (scottyhardy/docker-remote-desktop): logon, full desktop rendering, keyboard and mouse input.
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Security.Cryptography;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AADJoin.Creds
|
|
{
|
|
public class DeviceCreds
|
|
{
|
|
public string Id { get; set; }
|
|
public RSA Key { get; set; }
|
|
public X509Certificate Certificate { get; set; }
|
|
|
|
public DeviceCreds(string id, RSA key, X509Certificate certificate)
|
|
{
|
|
Id = id;
|
|
Key = key;
|
|
Certificate = certificate;
|
|
}
|
|
|
|
public DeviceCreds(RSA key, X509Certificate certificate)
|
|
{
|
|
Console.WriteLine(certificate.Subject);
|
|
Id = certificate.Subject.Split('=')[1];
|
|
Key = key;
|
|
Certificate = certificate;
|
|
}
|
|
|
|
public static DeviceCreds Empty()
|
|
{
|
|
return new DeviceCreds(null, null, null);
|
|
}
|
|
|
|
public static DeviceCreds FromPfx(string pfxPath, string password)
|
|
{
|
|
X509Certificate2 cert = new X509Certificate2(pfxPath, password, X509KeyStorageFlags.Exportable);
|
|
|
|
return new DeviceCreds(
|
|
cert.GetRSAPrivateKey(),
|
|
new X509Certificate(Convert.FromHexString(cert.GetRawCertDataString()))
|
|
);
|
|
}
|
|
}
|
|
}
|