Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable DSA tests #1181

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Enable DSA tests
  • Loading branch information
Rob-Hague committed Sep 23, 2023
commit 7c7b8855f9522a0d762cd006919c1c545dad847a
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ Private keys can be encrypted using one of the following cipher methods:
* ecdsa-sha2-nistp256
* ecdsa-sha2-nistp384
* ecdsa-sha2-nistp521
* rsa-sha2-512
* rsa-sha2-256
* ssh-rsa
* ssh-dss

Expand Down
7 changes: 2 additions & 5 deletions src/Renci.SshNet.IntegrationTests/HostKeyAlgorithmTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ public void TearDown()
}

[TestMethod]
[Ignore] // No longer supported in recent versions of OpenSSH
// TODO: We should be able to enable some legacy settings to make it work
// https://www.openssh.com/legacy.html e.g. PubkeyAcceptedKeyTypes / HostbasedAcceptedKeyTypes ?
public void SshDsa()
public void SshDss()
{
DoTest(HostKeyAlgorithm.SshDsa, HostKeyFile.Dsa, 1024);
DoTest(HostKeyAlgorithm.SshDss, HostKeyFile.Dsa, 2048);
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet.IntegrationTests/HostKeyFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public sealed class HostKeyFile
{
public static readonly HostKeyFile Rsa = new HostKeyFile("ssh-rsa", "/etc/ssh/ssh_host_rsa_key", new byte[] { 0x3d, 0x90, 0xd8, 0x0d, 0xd5, 0xe0, 0xb6, 0x13, 0x42, 0x7c, 0x78, 0x1e, 0x19, 0xa3, 0x99, 0x2b });
public static readonly HostKeyFile Dsa = new HostKeyFile("ssh-dsa", "/etc/ssh/ssh_host_dsa_key", new byte[] { 0x3d, 0x90, 0xd8, 0x0d, 0xd5, 0xe0, 0xb6, 0x13, 0x42, 0x7c, 0x78, 0x1e, 0x19, 0xa3, 0x99, 0x2b });
public static readonly HostKeyFile Dsa = new HostKeyFile("ssh-dsa", "/etc/ssh/ssh_host_dsa_key", new byte[] { 0x50, 0xe0, 0xd5, 0x11, 0xf7, 0xed, 0x54, 0x75, 0x0d, 0x03, 0xc6, 0x52, 0x9b, 0x3b, 0x3c, 0x9f });
public static readonly HostKeyFile Ed25519 = new HostKeyFile("ssh-ed25519", "/etc/ssh/ssh_host_ed25519_key", new byte[] { 0xb3, 0xb9, 0xd0, 0x1b, 0x73, 0xc4, 0x60, 0xb4, 0xce, 0xed, 0x06, 0xf8, 0x58, 0x49, 0xa3, 0xda });
public const string Ecdsa = "/etc/ssh/ssh_host_ecdsa_key";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ public void TearDown()
}

[TestMethod]
[Ignore] // No longer supported in recent versions of OpenSSH
// TODO: We should be able to enable some legacy settings to make it work
// https://www.openssh.com/legacy.html e.g. PubkeyAcceptedKeyTypes / HostbasedAcceptedKeyTypes ?
public void SshDsa()
public void SshDss()
{
DoTest(PublicKeyAlgorithm.SshDss, "id_dsa");
}
Expand Down
20 changes: 20 additions & 0 deletions src/Renci.SshNet.IntegrationTests/server/ssh/ssh_host_dsa_key
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----BEGIN DSA PRIVATE KEY-----
MIIDPgIBAAKCAQEAuXza5HoqeOTKgTBY0iTglJGVLmmGvp9mWbrx20Xj8V1ouy8u
0ceju7/4AR6m9BzYWm2sAMAwvQcDeUi6pD4C4oIRzQSOg/nuUJO6RkneLQjMYEzD
61FokmxcUzHXQiKtqRRGL97naxj5fFIOppQXfllRASuvHeiG+I6EiFJL4zL7Uwen
CshEkpZsLZ2Xj8nfaD8yPmviDT/QWRUsZgw8lte7MonYVdKd0yeRQwS3vgJwusZv
fFHP4X7aXSwDJTlTGagxFV7jCktwtSc6QFoLWv5LZ2OAJxmgBM1HJQKOnP8dvn56
EZub3DQrx3IpAgtsxa/8bxt/xFbbfp4sDHwLLQIVAKTEaiNtqneHljGoEGhUWJrs
+kdpAoIBAQCdBG7aHBIV83/icpkELAZ87I/0XDA9pVG+Sgs/OFgUd24tXi9S+dwp
LsVMVaBnN9TaEwZYR6z7Zg12r2j2q8BDTrRwwYHYJvwjHtsZVqaHi35fgBT2RO4T
SqRKYjrjb4mtPodUEo7CzK5+rLpvLM1SiiHfeqmUJqbkDwxQ9xXkCjRP50huJ+tA
ccgQIUyOYioz9omszJGANZlF5ZabzbAiTcXews2p97OeFWNTGTbXebV3FPSV+KBO
c0A5jxzQhEo3Kk58GXuog8t3OksNISdZPIJxHn+th644ZOj0L1v6PrUbXshPL1hp
VNlbn9fO4/HbQzL4NThmgzaZkT2FqxPxAoIBADuwcLTKtLX2cy9cqFiraeEaBXT3
lQiPTFSLQKVm/k+iumXuOy5Fh3Akzu35MpNLK2gsdoWN9ZRQ8eWODdcnFXSJrnqX
cMWV6ONQ+nZ9YHrRp47KHKWKe+2c0T++S8QZAimb3KCjSOyEwn+i4aAGIvoaYIoH
+tRKmeL+7z1Ff/zJEB1FYVDmcqxhUKd74En6O17EmUHPfiQvwwTYvP5NvlLB23Hz
9ZO4nwrUSUIyVsWYT01s0JThkjI06N0dqKS1we94Ht1mT7iNJ5x5DhVR6qSNOgQH
FMKxKdXHdSFopwwHUrzm3BpKzKW3NuQHazcdZEl1vHb6LpfTv6O6bZIANyACFGBZ
9othW6gmt8t4cI6IyoaLCtLp
-----END DSA PRIVATE KEY-----
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyN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t+bBcXkpxW//7WC29WOXW3t90ySTh+cWuWfr9fV7mf4Ql/6u/ZIgpQNvnNYezazt3fK8EXjI1dAXEuQxE=
2 changes: 1 addition & 1 deletion src/Renci.SshNet.TestTools.OpenSSH/HostKeyAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class HostKeyAlgorithm
public static readonly HostKeyAlgorithm RsaSha2512 = new HostKeyAlgorithm("rsa-sha2-512");
public static readonly HostKeyAlgorithm RsaSha2256 = new HostKeyAlgorithm("rsa-sha2-256");
public static readonly HostKeyAlgorithm SshRsa = new HostKeyAlgorithm("ssh-rsa");
public static readonly HostKeyAlgorithm SshDsa = new HostKeyAlgorithm("ssh-dsa");
public static readonly HostKeyAlgorithm SshDss = new HostKeyAlgorithm("ssh-dss");

public HostKeyAlgorithm(string name)
{
Expand Down