Unable to match sshkey using C# – able to connect interactively
Hello!
Thanks in advancé for your help!
I've tried everything I can think of...
I can connect interactively with WinSCP, log part:
C#
message from server:
Thanks in advance, Dave
Thanks in advancé for your help!
I've tried everything I can think of...
I can connect interactively with WinSCP, log part:
. 2025-04-23 08:38:18.126 Remote version: SSH-2.0-AWS_SFTP_1.2 . 2025-04-23 08:38:18.126 Using SSH protocol version 2 . 2025-04-23 08:38:18.126 Have a known host key of type ssh-ed25519 . 2025-04-23 08:38:18.260 Doing ECDH key exchange with curve nistp256 and hash SHA-256 . 2025-04-23 08:38:18.441 Server also has ecdsa-sha2-nistp521 host key, but we don't know it . 2025-04-23 08:38:18.442 Host key fingerprint is: . 2025-04-23 08:38:18.442 ssh-ed25519 255 SHA256:Y9eKTIbPMgStKTOOGhtA+zTYakwJoHNNHqjEXVIHAgg . 2025-04-23 08:38:18.451 Host key matches cached key . 2025-04-23 08:38:18.452 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption . 2025-04-23 08:38:18.452 Initialised HMAC-SHA-256 outbound MAC algorithm (in ETM mode) . 2025-04-23 08:38:18.452 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
sshkey = "ssh-ed25519 255 SHA256:Y9eKTIbPMgStKTOOGhtA+zTYakwJoHNNHqjEXVIHAgg";
System.ArgumentException: SSH host key fingerprint "ssh-ed25519 255 SHA256:Y9eKTIbPMgStKTOOGhtA+zTYakwJoHNNHqjEXVIHAgg" does not match pattern /((ssh-rsa|ssh-dss|ssh-ed25519|ecdsa-sha2-nistp(256|384|521))( |-))?(\d+ )?(([0-9a-f]{2}(:|-)){15}[0-9a-f]{2}|[0-9a-zA-Z+/]{43}=)(;((ssh-rsa|ssh-dss|ssh-ed25519|ecdsa-sha2-nistp(256|384|521))( |-))?(\d+ )?(([0-9a-f]{2}(:|-)){15}[0-9a-f]{2}|[0-9a-zA-Z+/]{43}=))*/ at WinSCP.SessionOptions.SetSshHostKeyFingerprint(String s) at WinSCP.SessionOptions.set_SshHostKeyFingerprint(String value) at MsiAvail.Form1.DoSession() in C:\Users\dport\Documents\Visual Studio 2017\MsiAvail\MsiAvail\MsiAvail\Form1.cs:line 146