Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
drieseng committed Sep 20, 2017
2 parents bc080e8 + c71d7f6 commit cdf50d2
Show file tree
Hide file tree
Showing 161 changed files with 8,456 additions and 723 deletions.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ This project was inspired by **Sharp.SSH** library which was ported from java an
* Universal Windows Platform 10

## Usage
Establish an SFTP connection using both password and public-key authentication:

### Multi-factor authentication

Establish a SFTP connection using both password and public-key authentication:

```cs
var connectionInfo = new ConnectionInfo("sftp.foo.com",
Expand All @@ -73,6 +76,40 @@ using (var client = new SftpClient(connectionInfo))

```

### Verify host identify

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:

```cs
byte[] expectedFingerPrint = new byte[] {
0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
};

using (var client = new SshClient("sftp.foo.com", "guest", "pwd"))
{
client.HostKeyReceived += (sender, e) =>
{
if (expectedFingerPrint.Length == e.FingerPrint.Length)
{
for (var i = 0; i < expectedFingerPrint.Length; i++)
{
if (expectedFingerPrint[i] != e.FingerPrint[i])
{
e.CanTrust = false;
break;
}
}
}
else
{
e.CanTrust = false;
}
};
client.Connect();
}
```

## Building SSH.NET

Software | net35 | net40 | netstandard1.3 | sl4 | sl5 | wp71 | wp8 | uap10.0 |
Expand Down
4 changes: 2 additions & 2 deletions build/nuget/SSH.NET.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>SSH.NET</id>
<version>2016.1.0-beta2</version>
<version>2016.1.0-beta3</version>
<title>SSH.NET</title>
<authors>Renci</authors>
<owners>olegkap,drieseng</owners>
<licenseUrl>https://github.com/sshnet/SSH.NET/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/sshnet/SSH.NET/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism and with broad framework support.</description>
<releaseNotes>https://github.com/sshnet/SSH.NET/releases/tag/2016.1.0-beta2</releaseNotes>
<releaseNotes>https://github.com/sshnet/SSH.NET/releases/tag/2016.1.0-beta3</releaseNotes>
<summary>A Secure Shell (SSH) library for .NET, optimized for parallelism.</summary>
<copyright>2012-2017, RENCI</copyright>
<language>en-US</language>
Expand Down
30 changes: 1 addition & 29 deletions src/Renci.SshNet.NET35/Common/Extensions.NET35.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,15 @@
using System;
using System.Diagnostics;
using System.Net.Sockets;
using System.Security.Cryptography;
using System.Text;
using System.Threading;

namespace Renci.SshNet
namespace Renci.SshNet.Common
{
/// <summary>
/// Collection of different extension method specific for .NET 3.5
/// </summary>
internal static partial class Extensions
{
/// <summary>
/// Disposes the specified socket.
/// </summary>
/// <param name="socket">The socket.</param>
[DebuggerNonUserCode]
internal static void Dispose(this Socket socket)
{
if (socket == null)
throw new NullReferenceException();

socket.Close();
}

/// <summary>
/// Disposes the specified handle.
/// </summary>
/// <param name="handle">The handle.</param>
[DebuggerNonUserCode]
internal static void Dispose(this WaitHandle handle)
{
if (handle == null)
throw new NullReferenceException();

handle.Close();
}

/// <summary>
/// Disposes the specified algorithm.
/// </summary>
Expand Down
20 changes: 19 additions & 1 deletion src/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
<Link>Common\PortForwardEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
<Link>Common\PosixPath.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
<Link>Common\ProxyException.cs</Link>
</Compile>
Expand Down Expand Up @@ -305,6 +308,9 @@
<Compile Include="..\Renci.SshNet\IForwardedPort.cs">
<Link>IForwardedPort.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IRemotePathTransformation.cs">
<Link>IRemotePathTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IServiceFactory.cs">
<Link>IServiceFactory.cs</Link>
</Compile>
Expand Down Expand Up @@ -575,6 +581,18 @@
<Compile Include="..\Renci.SshNet\ProxyTypes.cs">
<Link>ProxyTypes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathDoubleQuoteTransformation.cs">
<Link>RemotePathDoubleQuoteTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathNoneTransformation.cs">
<Link>RemotePathNoneTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathShellQuoteTransformation.cs">
<Link>RemotePathShellQuoteTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathTransformation.cs">
<Link>RemotePathTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ScpClient.cs">
<Link>ScpClient.cs</Link>
</Compile>
Expand Down Expand Up @@ -953,7 +971,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet.NETCore/Renci.SshNet.NETCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<Compile Update="..\Renci.SshNet\Sftp\SftpMessageFactory.cs" Link="Sftp\SftpResponseFactory.cs" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<DefineConstants>FEATURE_ENCODING_ASCII;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_MEMORYSTREAM_TRYGETBUFFER;FEATURE_REFLECTION_TYPEINFO;FEATURE_RNG_CREATE;FEATURE_SOCKET_TAP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_SELECT;FEATURE_SOCKET_POLL;FEATURE_DNS_TAP;FEATURE_STREAM_TAP;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_HASH_MD5;FEATURE_HASH_SHA1_CREATE;FEATURE_HASH_SHA256_CREATE;FEATURE_HASH_SHA384_CREATE;FEATURE_HASH_SHA512_CREATE;FEATURE_HMAC_MD5;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_HMAC_SHA384;FEATURE_HMAC_SHA512</DefineConstants>
<DefineConstants>FEATURE_ENCODING_ASCII;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_MEMORYSTREAM_TRYGETBUFFER;FEATURE_REFLECTION_TYPEINFO;FEATURE_RNG_CREATE;FEATURE_SOCKET_TAP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_SELECT;FEATURE_SOCKET_POLL;FEATURE_SOCKET_DISPOSE;FEATURE_DNS_TAP;FEATURE_STREAM_TAP;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_HASH_MD5;FEATURE_HASH_SHA1_CREATE;FEATURE_HASH_SHA256_CREATE;FEATURE_HASH_SHA384_CREATE;FEATURE_HASH_SHA512_CREATE;FEATURE_HMAC_MD5;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_HMAC_SHA384;FEATURE_HMAC_SHA512</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>portable</DebugType>
Expand Down
22 changes: 20 additions & 2 deletions src/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>TRACE;DEBUG;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_MEMORYSTREAM_GETBUFFER</DefineConstants>
<DefineConstants>TRACE;DEBUG;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_DISPOSE;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_MEMORYSTREAM_GETBUFFER</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
Expand All @@ -40,7 +40,7 @@
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_MEMORYSTREAM_GETBUFFER</DefineConstants>
<DefineConstants>TRACE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_DISPOSE;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_MEMORYSTREAM_GETBUFFER</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
Expand Down Expand Up @@ -209,6 +209,9 @@
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
<Link>Common\PortForwardEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
<Link>Common\PosixPath.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
<Link>Common\ProxyException.cs</Link>
</Compile>
Expand Down Expand Up @@ -311,6 +314,9 @@
<Compile Include="..\Renci.SshNet\IForwardedPort.cs">
<Link>IForwardedPort.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IRemotePathTransformation.cs">
<Link>IRemotePathTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IServiceFactory.cs">
<Link>IServiceFactory.cs</Link>
</Compile>
Expand Down Expand Up @@ -569,6 +575,18 @@
<Compile Include="..\Renci.SshNet\ProxyTypes.cs">
<Link>ProxyTypes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathDoubleQuoteTransformation.cs">
<Link>RemotePathDoubleQuoteTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathNoneTransformation.cs">
<Link>RemotePathNoneTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathShellQuoteTransformation.cs">
<Link>RemotePathShellQuoteTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathTransformation.cs">
<Link>RemotePathTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ScpClient.cs">
<Link>ScpClient.cs</Link>
</Compile>
Expand Down
22 changes: 20 additions & 2 deletions src/Renci.SshNet.Silverlight5/Renci.SshNet.Silverlight5.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>TRACE;DEBUG;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256</DefineConstants>
<DefineConstants>TRACE;DEBUG;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_DISPOSE;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
Expand All @@ -42,7 +42,7 @@
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256</DefineConstants>
<DefineConstants>TRACE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_DISPOSE;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
Expand Down Expand Up @@ -218,6 +218,9 @@
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
<Link>Common\PortForwardEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
<Link>Common\PosixPath.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
<Link>Common\ProxyException.cs</Link>
</Compile>
Expand Down Expand Up @@ -320,6 +323,9 @@
<Compile Include="..\Renci.SshNet\IForwardedPort.cs">
<Link>IForwardedPort.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IRemotePathTransformation.cs">
<Link>IRemotePathTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IServiceFactory.cs">
<Link>IServiceFactory.cs</Link>
</Compile>
Expand Down Expand Up @@ -578,6 +584,18 @@
<Compile Include="..\Renci.SshNet\ProxyTypes.cs">
<Link>ProxyTypes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathDoubleQuoteTransformation.cs">
<Link>RemotePathDoubleQuoteTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathNoneTransformation.cs">
<Link>RemotePathNoneTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathShellQuoteTransformation.cs">
<Link>RemotePathShellQuoteTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathTransformation.cs">
<Link>RemotePathTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ScpClient.cs">
<Link>ScpClient.cs</Link>
</Compile>
Expand Down
Loading

0 comments on commit cdf50d2

Please sign in to comment.