Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechNagorski authored Sep 13, 2023
2 parents 2f7227b + 9593e87 commit aff1a58
Show file tree
Hide file tree
Showing 138 changed files with 16,144 additions and 3,505 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Private keys can be encrypted using one of the following cipher methods:
## Framework Support
**SSH.NET** supports the following target frameworks:
* .NETFramework 4.6.2 (and higher)
* .NET Standard 2.0
* .NET Standard 2.0 and 2.1
* .NET 6 (and higher)

## Usage
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ build:

test_script:
- cmd: >-
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net462\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration&TestCategory!=LongRunning" --blame
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net462\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration" --blame
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net7.0\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration&TestCategory!=LongRunning" --blame
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net7.0\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration" --blame
4 changes: 4 additions & 0 deletions build/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\netstandard2.0</OutputDirectory>
<Moniker>netstandard2.0</Moniker>
</TargetFrameworkModern>
<TargetFrameworkModern Include=".NETStandard 2.1">
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\netstandard2.1</OutputDirectory>
<Moniker>netstandard2.1</Moniker>
</TargetFrameworkModern>
<TargetFrameworkModern Include=".NET 6.0">
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\net6.0</OutputDirectory>
<Moniker>net6.0</Moniker>
Expand Down
3 changes: 3 additions & 0 deletions build/nuget/SSH.NET.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<group targetFramework="net462" />
<group targetFramework="netstandard2.0">
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
</group>
<group targetFramework="netstandard2.1">
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
</group>
<group targetFramework="net6.0">
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
Expand Down
32 changes: 32 additions & 0 deletions src/Renci.SshNet.IntegrationTests/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[*.cs]

#### SYSLIB diagnostics ####

# SYSLIB1045: Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time
#
# TODO: Remove this when https://github.com/sshnet/SSH.NET/issues/1131 is implemented.
dotnet_diagnostic.SYSLIB1045.severity = none

### StyleCop Analyzers rules ###

#### .NET Compiler Platform analysers rules ####

# IDE0007: Use var instead of explicit type
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0007
dotnet_diagnostic.IDE0007.severity = suggestion

# IDE0028: Use collection initializers
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0028
dotnet_diagnostic.IDE0028.severity = suggestion

# IDE0058: Remove unnecessary expression value
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0058
dotnet_diagnostic.IDE0058.severity = suggestion

# IDE0059: Remove unnecessary value assignment
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0059
dotnet_diagnostic.IDE0059.severity = suggestion

# IDE0230: Use UTF-8 string literal
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0230
dotnet_diagnostic.IDE0230.severity = suggestion
1 change: 1 addition & 0 deletions src/Renci.SshNet.IntegrationTests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TestResults/
23 changes: 23 additions & 0 deletions src/Renci.SshNet.IntegrationTests/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<trace autoflush="true"/>
<sources>
<source name="SshNet.Logging" switchName="SshNetSwitch" switchType="System.Diagnostics.SourceSwitch">
<listeners>
<!--<add name="SshDotNetTraceFile" />-->
<!--<add name="Console"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="SshNetSwitch" value="Verbose"/>
</switches>
<sharedListeners>
<add name="SshDotNetTraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="SshNetTrace.log">
<!--<filter type="System.Diagnostics.EventTypeFilter" initializeData="Warning" />-->
</add>
<add name="Console" type="System.Diagnostics.ConsoleTraceListener" traceOutputOptions="DateTime,Timestamp,ThreadId"/>
</sharedListeners>
</system.diagnostics>
</configuration>
84 changes: 84 additions & 0 deletions src/Renci.SshNet.IntegrationTests/AuthenticationMethodFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
namespace Renci.SshNet.IntegrationTests
{
public class AuthenticationMethodFactory
{
public PasswordAuthenticationMethod CreatePowerUserPasswordAuthenticationMethod()
{
var user = Users.Admin;
return new PasswordAuthenticationMethod(user.UserName, user.Password);
}

public PrivateKeyAuthenticationMethod CreateRegularUserPrivateKeyAuthenticationMethod()
{
var privateKeyFile = GetPrivateKey("Renci.SshNet.IntegrationTests.resources.client.id_rsa");
return new PrivateKeyAuthenticationMethod(Users.Regular.UserName, privateKeyFile);
}

public PrivateKeyAuthenticationMethod CreateRegularUserMultiplePrivateKeyAuthenticationMethod()
{
var privateKeyFile1 = GetPrivateKey("Renci.SshNet.IntegrationTests.resources.client.id_rsa");
var privateKeyFile2 = GetPrivateKey("Renci.SshNet.IntegrationTests.resources.client.id_rsa");
return new PrivateKeyAuthenticationMethod(Users.Regular.UserName, privateKeyFile1, privateKeyFile2);
}

public PrivateKeyAuthenticationMethod CreateRegularUserPrivateKeyWithPassPhraseAuthenticationMethod()
{
var privateKeyFile = GetPrivateKey("Renci.SshNet.IntegrationTests.resources.client.id_rsa_with_pass", "tester");
return new PrivateKeyAuthenticationMethod(Users.Regular.UserName, privateKeyFile);
}

public PrivateKeyAuthenticationMethod CreateRegularUserPrivateKeyWithEmptyPassPhraseAuthenticationMethod()
{
var privateKeyFile = GetPrivateKey("Renci.SshNet.IntegrationTests.resources.client.id_rsa_with_pass", null);
return new PrivateKeyAuthenticationMethod(Users.Regular.UserName, privateKeyFile);
}

public PrivateKeyAuthenticationMethod CreateRegularUserPrivateKeyAuthenticationMethodWithBadKey()
{
var privateKeyFile = GetPrivateKey("Renci.SshNet.IntegrationTests.resources.client.id_noaccess.rsa");
return new PrivateKeyAuthenticationMethod(Users.Regular.UserName, privateKeyFile);
}

public PasswordAuthenticationMethod CreateRegulatUserPasswordAuthenticationMethod()
{
return new PasswordAuthenticationMethod(Users.Regular.UserName, Users.Regular.Password);
}

public PasswordAuthenticationMethod CreateRegularUserPasswordAuthenticationMethodWithBadPassword()
{
return new PasswordAuthenticationMethod(Users.Regular.UserName, "xxx");
}

public KeyboardInteractiveAuthenticationMethod CreateRegularUserKeyboardInteractiveAuthenticationMethod()
{
var keyboardInteractive = new KeyboardInteractiveAuthenticationMethod(Users.Regular.UserName);
keyboardInteractive.AuthenticationPrompt += (sender, args) =>
{
foreach (var authenticationPrompt in args.Prompts)
{
authenticationPrompt.Response = Users.Regular.Password;
}
};
return keyboardInteractive;
}

private PrivateKeyFile GetPrivateKey(string resourceName, string passPhrase = null)
{
using (var stream = GetResourceStream(resourceName))
{
return new PrivateKeyFile(stream, passPhrase);
}
}

private Stream GetResourceStream(string resourceName)
{
var type = GetType();
var resourceStream = type.Assembly.GetManifestResourceStream(resourceName);
if (resourceStream == null)
{
throw new ArgumentException($"Resource '{resourceName}' not found in assembly '{type.Assembly.FullName}'.", nameof(resourceName));
}
return resourceStream;
}
}
}
Loading

0 comments on commit aff1a58

Please sign in to comment.