Skip to content

Commit 13954d0

Browse files
committed
Merge branch 'master' into jump-channel
2 parents 726fbc1 + 2bbfee4 commit 13954d0

File tree

781 files changed

+31470
-22893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

781 files changed

+31470
-22893
lines changed

.editorconfig

+1,246
Large diffs are not rendered by default.

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ project.lock.json
2222

2323
# Build outputs
2424
build/target/
25+
26+
# Benchmark results
27+
BenchmarkDotNet.Artifacts/

CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @drieseng
1+
* @drieseng @WojciechNagorski

Directory.Build.props

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<Project>
2+
<Import Project="$(MSBuildThisFileFullPath).user" Condition="Exists('$(MSBuildThisFileFullPath).user')" />
3+
4+
<!--
5+
Assembly Info properties that apply to all projects/assemblies.
6+
-->
7+
<PropertyGroup>
8+
<SignAssembly>true</SignAssembly>
9+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)src\Renci.SshNet.snk</AssemblyOriginatorKeyFile>
10+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11+
<LangVersion>latest</LangVersion>
12+
<WarningLevel>9999</WarningLevel>
13+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
14+
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
15+
</PropertyGroup>
16+
17+
<!--
18+
Code analysis properties.
19+
-->
20+
<PropertyGroup>
21+
<EnableNETAnalyzers>false</EnableNETAnalyzers>
22+
<AnalysisLevel>preview-All</AnalysisLevel>
23+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
24+
</PropertyGroup>
25+
26+
<!--
27+
Add the stylecop config to each project.
28+
-->
29+
<ItemGroup>
30+
<AdditionalFiles Include="..\..\stylecop.json" Link="stylecop.json" />
31+
</ItemGroup>
32+
33+
<!--
34+
Use fixed version of analyzers.
35+
-->
36+
<ItemGroup>
37+
<!--
38+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview1.23165.1" PrivateAssets="all" />
39+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
40+
<PackageReference Include="Meziantou.Analyzer" Version="2.0.54" PrivateAssets="all" />
41+
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.55.0.65544" PrivateAssets="all" />
42+
-->
43+
</ItemGroup>
44+
</Project>

LICENSE

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
The MIT License (MIT)
22

3+
Copyright (c) Renci, Oleg Kapeljushnik, Gert Driesen and contributors
4+
35
Permission is hereby granted, free of charge, to any person obtaining a copy
46
of this software and associated documentation files (the "Software"), to deal
57
in the Software without restriction, including without limitation the rights

README.md

+7-38
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Private keys can be encrypted using one of the following cipher methods:
9797
* ecdsa-sha2-nistp256
9898
* ecdsa-sha2-nistp384
9999
* ecdsa-sha2-nistp521
100+
* rsa-sha2-512
101+
* rsa-sha2-256
100102
* ssh-rsa
101103
* ssh-dss
102104

@@ -116,15 +118,9 @@ Private keys can be encrypted using one of the following cipher methods:
116118

117119
## Framework Support
118120
**SSH.NET** supports the following target frameworks:
119-
* .NET Framework 3.5
120-
* .NET Framework 4.0 (and higher)
121-
* .NET Standard 1.3
122-
* .NET Standard 2.0
123-
* Silverlight 4
124-
* Silverlight 5
125-
* Windows Phone 7.1
126-
* Windows Phone 8.0
127-
* Universal Windows Platform 10
121+
* .NETFramework 4.6.2 (and higher)
122+
* .NET Standard 2.0 and 2.1
123+
* .NET 6 (and higher)
128124

129125
## Usage
130126

@@ -149,45 +145,18 @@ using (var client = new SftpClient(connectionInfo))
149145
Establish a SSH connection using user name and password, and reject the connection if the fingerprint of the server does not match the expected fingerprint:
150146

151147
```cs
152-
byte[] expectedFingerPrint = new byte[] {
153-
0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
154-
0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
155-
};
148+
string expectedFingerPrint = "LKOy5LvmtEe17S4lyxVXqvs7uPMy+yF79MQpHeCs/Qo";
156149

157150
using (var client = new SshClient("sftp.foo.com", "guest", "pwd"))
158151
{
159152
client.HostKeyReceived += (sender, e) =>
160153
{
161-
if (expectedFingerPrint.Length == e.FingerPrint.Length)
162-
{
163-
for (var i = 0; i < expectedFingerPrint.Length; i++)
164-
{
165-
if (expectedFingerPrint[i] != e.FingerPrint[i])
166-
{
167-
e.CanTrust = false;
168-
break;
169-
}
170-
}
171-
}
172-
else
173-
{
174-
e.CanTrust = false;
175-
}
154+
e.CanTrust = expectedFingerPrint.Equals(e.FingerPrintSHA256);
176155
};
177156
client.Connect();
178157
}
179158
```
180159

181-
## Building SSH.NET
182-
183-
Software | net35 | net40 | netstandard1.3 | netstandard2.0 | sl4 | sl5 | wp71 | wp8 | uap10.0 |
184-
--------------------------------- | :---: | :---: | :------------: | :------------: | :-: | :-: | :--: | :-: | :-----: |
185-
Windows Phone SDK 8.0 | | | | | x | x | x | x |
186-
Visual Studio 2012 Update 5 | x | x | | | x | x | x | x |
187-
Visual Studio 2015 Update 3 | x | x | | | | x | | x | x
188-
Visual Studio 2017 | x | x | x | x | | | | |
189-
Visual Studio 2019 | x | x | x | x | | | | |
190-
191160
## Supporting SSH.NET
192161

193162
Do you or your company rely on **SSH.NET** in your projects? If you want to encourage us to keep on going and show us that you appreciate our work, please consider becoming a [sponsor](https://github.com/sponsors/sshnet) through GitHub Sponsors.

appveyor.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
os: Visual Studio 2019
1+
os: Visual Studio 2022
22

33
before_build:
4-
- nuget restore src\Renci.SshNet.VS2019.sln
4+
- nuget restore src\Renci.SshNet.sln
55

66
build:
7-
project: src\Renci.SshNet.VS2019.sln
7+
project: src\Renci.SshNet.sln
88
verbosity: minimal
99

1010
test_script:
1111
- cmd: >-
12-
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net35\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration&TestCategory!=LongRunning"
13-
14-
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net472\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration&TestCategory!=LongRunning"
12+
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net462\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration" --blame
13+
14+
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net7.0\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration" --blame

build/build.proj

+22-97
Original file line numberDiff line numberDiff line change
@@ -8,86 +8,41 @@
88
<MSBuildTasksPackageId>MSBuildTasks</MSBuildTasksPackageId>
99
<MSBuildTasksPackageVersion>1.5.0.214</MSBuildTasksPackageVersion>
1010
</PropertyGroup>
11-
12-
<ItemGroup>
13-
<VisualStudioVersionClassic Include="2012">
14-
<SolutionFile>$(MSBuildThisFileDirectory)..\src\Renci.SshNet.VS2012.sln</SolutionFile>
15-
<ToolsVersion>14.0</ToolsVersion>
16-
<VisualStudioVersion>14.0</VisualStudioVersion>
17-
</VisualStudioVersionClassic>
18-
<VisualStudioVersionClassic Include="2015">
19-
<SolutionFile>$(MSBuildThisFileDirectory)..\src\Renci.SshNet.VS2015.sln</SolutionFile>
20-
<ToolsVersion>14.0</ToolsVersion>
21-
<VisualStudioVersion>14.0</VisualStudioVersion>
22-
</VisualStudioVersionClassic>
23-
</ItemGroup>
24-
25-
<ItemGroup>
26-
<VisualStudioVersionModern Include="2019">
27-
<SolutionFile>$(MSBuildThisFileDirectory)..\src\Renci.SshNet.VS2019.sln</SolutionFile>
28-
<VisualStudioVersion>16.0</VisualStudioVersion>
29-
</VisualStudioVersionModern>
30-
</ItemGroup>
3111

3212
<ItemGroup>
33-
<TargetFrameworkClassic Include="Windows Phone Silverlight 7.1">
34-
<OutputDirectory>Renci.SshNet.WindowsPhone\bin\$(Configuration)</OutputDirectory>
35-
<Moniker>wp71</Moniker>
36-
</TargetFrameworkClassic>
37-
<TargetFrameworkClassic Include="Windows Phone Silverlight 8.0">
38-
<OutputDirectory>Renci.SshNet.WindowsPhone8\bin\$(Configuration)</OutputDirectory>
39-
<Moniker>wp8</Moniker>
40-
</TargetFrameworkClassic>
41-
<TargetFrameworkClassic Include="Silverlight 4">
42-
<OutputDirectory>Renci.SshNet.Silverlight\bin\$(Configuration)</OutputDirectory>
43-
<Moniker>sl4</Moniker>
44-
</TargetFrameworkClassic>
45-
<TargetFrameworkClassic Include="Silverlight 5">
46-
<OutputDirectory>Renci.SshNet.Silverlight5\bin\$(Configuration)</OutputDirectory>
47-
<Moniker>sl5</Moniker>
48-
</TargetFrameworkClassic>
49-
<TargetFrameworkClassic Include="Universal Windows Platform 10">
50-
<OutputDirectory>Renci.SshNet.UAP10\bin\$(Configuration)</OutputDirectory>
51-
<Moniker>uap10</Moniker>
52-
</TargetFrameworkClassic>
13+
<VisualStudioVersionModern Include="2022">
14+
<SolutionFile>$(MSBuildThisFileDirectory)..\src\Renci.SshNet.sln</SolutionFile>
15+
<VisualStudioVersion>17.0</VisualStudioVersion>
16+
</VisualStudioVersionModern>
5317
</ItemGroup>
5418

5519
<ItemGroup>
56-
<TargetFrameworkModern Include=".NET Framework 3.5">
57-
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\net35</OutputDirectory>
58-
<Moniker>net35</Moniker>
59-
</TargetFrameworkModern>
60-
<TargetFrameworkModern Include=".NET Framework 4.0">
61-
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\net40</OutputDirectory>
62-
<Moniker>net40</Moniker>
63-
</TargetFrameworkModern>
64-
<TargetFrameworkModern Include=".NETStandard 1.3">
65-
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\netstandard1.3</OutputDirectory>
66-
<Moniker>netstandard1.3</Moniker>
20+
<TargetFrameworkModern Include=".NET Framework 4.6.2">
21+
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\net462</OutputDirectory>
22+
<Moniker>net462</Moniker>
6723
</TargetFrameworkModern>
6824
<TargetFrameworkModern Include=".NETStandard 2.0">
6925
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\netstandard2.0</OutputDirectory>
7026
<Moniker>netstandard2.0</Moniker>
7127
</TargetFrameworkModern>
28+
<TargetFrameworkModern Include=".NETStandard 2.1">
29+
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\netstandard2.1</OutputDirectory>
30+
<Moniker>netstandard2.1</Moniker>
31+
</TargetFrameworkModern>
32+
<TargetFrameworkModern Include=".NET 6.0">
33+
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\net6.0</OutputDirectory>
34+
<Moniker>net6.0</Moniker>
35+
</TargetFrameworkModern>
36+
<TargetFrameworkModern Include=".NET 7.0">
37+
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\net7.0</OutputDirectory>
38+
<Moniker>net7.0</Moniker>
39+
</TargetFrameworkModern>
7240
</ItemGroup>
73-
74-
<Target Name="CleanClassic" DependsOnTargets="CleanSolutionClassic">
75-
<RemoveDir Directories="$(MSBuildThisFileDirectory)target"/>
76-
</Target>
77-
41+
7842
<Target Name="CleanModern" DependsOnTargets="CleanSolutionModern">
7943
<RemoveDir Directories="$(MSBuildThisFileDirectory)target"/>
8044
</Target>
8145

82-
<Target Name="CleanSolutionClassic" Outputs="%(VisualStudioVersionClassic.Identity)">
83-
<ItemGroup>
84-
<ProjectToBuild Remove="@(ProjectToBuild)"/>
85-
<ProjectToBuild Include="%(VisualStudioVersionClassic.SolutionFile)">
86-
<Properties>Configuration=Release;VisualStudioVersion=%(VisualStudioVersionClassic.VisualStudioVersion)</Properties>
87-
</ProjectToBuild>
88-
</ItemGroup>
89-
<MSBuild Projects="@(ProjectToBuild)" ToolsVersion="%(VisualStudioVersionClassic.ToolsVersion)" Targets="Clean"/>
90-
</Target>
9146

9247
<Target Name="CleanSolutionModern" Outputs="%(VisualStudioVersionModern.Identity)">
9348
<ItemGroup>
@@ -99,26 +54,11 @@
9954
<MSBuild Projects="@(ProjectToBuild)" Targets="Clean"/>
10055
</Target>
10156

102-
<Target Name="RestoreNuGetPackagesClassic" DependsOnTargets="DownloadNuGet" Outputs="%(VisualStudioVersionClassic.Identity)">
103-
<Message Text="Restoring nuget packages for '%(VisualStudioVersionClassic.SolutionFile)'..." Importance="High"/>
104-
<Exec Command="$(NuGetExe) restore &quot;%(VisualStudioVersionClassic.SolutionFile)&quot;"/>
105-
</Target>
106-
10757
<Target Name="RestoreNuGetPackagesModern" DependsOnTargets="DownloadNuGet" Outputs="%(VisualStudioVersionModern.Identity)">
10858
<Message Text="Restoring nuget packages for '%(VisualStudioVersionModern.SolutionFile)'..." Importance="High"/>
10959
<Exec Command="$(NuGetExe) restore &quot;%(VisualStudioVersionModern.SolutionFile)&quot;"/>
11060
</Target>
111-
112-
<Target Name="BuildClassic" DependsOnTargets="RestoreNuGetPackagesClassic" Outputs="%(VisualStudioVersionClassic.Identity)">
113-
<ItemGroup>
114-
<ProjectToBuild Remove="@(ProjectToBuild)"/>
115-
<ProjectToBuild Include="%(VisualStudioVersionClassic.SolutionFile)">
116-
<Properties>Configuration=Release;VisualStudioVersion=%(VisualStudioVersionClassic.VisualStudioVersion)</Properties>
117-
</ProjectToBuild>
118-
</ItemGroup>
119-
<MSBuild Projects="@(ProjectToBuild)" ToolsVersion="%(VisualStudioVersionClassic.ToolsVersion)" Targets="Rebuild"/>
120-
</Target>
121-
61+
12262
<Target Name="BuildModern" DependsOnTargets="RestoreNuGetPackagesModern" Outputs="%(VisualStudioVersionModern.Identity)">
12363
<ItemGroup>
12464
<ProjectToBuild Remove="@(ProjectToBuild)"/>
@@ -131,12 +71,7 @@
13171

13272
<Target Name="Package" DependsOnTargets="CreateNuGetPackage;CreateBinPackage;GenerateHelpFile"/>
13373

134-
<Target Name="ValidatePackage" DependsOnTargets="ValidatePackageClassic;ValidatePackageModern"/>
135-
136-
<Target Name="ValidatePackageClassic" DependsOnTargets="CheckNuGetPackageDirectory" Outputs="%(TargetFrameworkClassic.Identity)">
137-
<Error Text="The 'Renci.SshNet.dll' file is not available for %(TargetFrameworkClassic.Identity) in $(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)." Condition="!Exists('$(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)\Renci.SshNet.dll')"/>
138-
<Error Text="The 'Renci.SshNet.xml' file is not available for %(TargetFrameworkClassic.Identity) in $(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)." Condition="!Exists('$(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)\Renci.SshNet.xml')"/>
139-
</Target>
74+
<Target Name="ValidatePackage" DependsOnTargets="ValidatePackageModern"/>
14075

14176
<Target Name="ValidatePackageModern" DependsOnTargets="CheckNuGetPackageDirectory" Outputs="%(TargetFrameworkModern.Identity)">
14277
<Error Text="The 'Renci.SshNet.dll' file is not available for %(TargetFrameworkModern.Identity) in $(NuGetPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)." Condition="!Exists('$(NuGetPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)\Renci.SshNet.dll')"/>
@@ -153,16 +88,6 @@
15388
<Move SourceFiles="$(MSBuildThisFileDirectory)target\help\SshNet.Help.chm" DestinationFiles="$(MSBuildThisFileDirectory)target\SSH.NET-$(ReleaseVersion)-help.chm"/>
15489
</Target>
15590

156-
<Target Name="PreparePackageClassic" DependsOnTargets="BuildClassic;CheckNuGetPackageDirectory;CheckBinaryZipPackageDirectory" Outputs="%(TargetFrameworkClassic.Identity)">
157-
<ItemGroup>
158-
<BuildOutput Remove="@(BuildOutput)"/>
159-
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFrameworkClassic.OutputDirectory)\Renci.SshNet.dll"/>
160-
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFrameworkClassic.OutputDirectory)\Renci.SshNet.xml"/>
161-
</ItemGroup>
162-
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)"/>
163-
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(BinPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)"/>
164-
</Target>
165-
16691
<Target Name="PreparePackageModern" DependsOnTargets="BuildModern;CheckNuGetPackageDirectory" Outputs="%(TargetFrameworkModern.Identity)">
16792
<ItemGroup>
16893
<BuildOutput Remove="@(BuildOutput)"/>

build/nuget/SSH.NET.nuspec

+6-25
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>SSH.NET</title>
77
<authors>Renci</authors>
88
<owners>olegkap,drieseng</owners>
9-
<licenseUrl>https://github.com/sshnet/SSH.NET/blob/master/LICENSE</licenseUrl>
9+
<license type="expression">MIT</license>
1010
<projectUrl>https://github.com/sshnet/SSH.NET/</projectUrl>
1111
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1212
<description>SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism and with broad framework support.</description>
@@ -16,37 +16,18 @@
1616
<language>en-US</language>
1717
<tags>ssh scp sftp</tags>
1818
<dependencies>
19-
<group targetFramework="net35" />
20-
<group targetFramework="net40" />
21-
<group targetFramework="netstandard1.3">
22-
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
23-
<dependency id="System.Diagnostics.TraceSource" version="4.3.0" />
24-
<dependency id="System.Net.NameResolution" version="4.3.0" />
25-
<dependency id="System.Net.Sockets" version="4.3.0" />
26-
<dependency id="System.Threading.Thread" version="4.3.0" />
27-
<dependency id="System.Threading.ThreadPool" version="4.3.0" />
28-
<dependency id="System.Threading.Timer" version="4.3.0" />
29-
<dependency id="System.Xml.XmlDocument" version="4.3.0" />
30-
<dependency id="System.Xml.XPath.XmlDocument" version="4.3.0" />
31-
</group>
19+
<group targetFramework="net462" />
3220
<group targetFramework="netstandard2.0">
3321
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
34-
</group>
35-
<group targetFramework="sl4">
36-
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
37-
</group>
38-
<group targetFramework="sl5">
39-
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
40-
</group>
41-
<group targetFramework="wp71">
22+
</group>
23+
<group targetFramework="netstandard2.1">
4224
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
4325
</group>
44-
<group targetFramework="wp8">
26+
<group targetFramework="net6.0">
4527
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
4628
</group>
47-
<group targetFramework="uap10.0">
29+
<group targetFramework="net7.0">
4830
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
49-
<dependency id="System.Xml.XPath.XmlDocument" version="4.3.0" />
5031
</group>
5132
</dependencies>
5233
</metadata>

0 commit comments

Comments
 (0)