Skip to content

Commit cdf50d2

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/develop'
2 parents bc080e8 + c71d7f6 commit cdf50d2

File tree

161 files changed

+8456
-723
lines changed

Some content is hidden

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

161 files changed

+8456
-723
lines changed

README.md

+38-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ This project was inspired by **Sharp.SSH** library which was ported from java an
5959
* Universal Windows Platform 10
6060

6161
## Usage
62-
Establish an SFTP connection using both password and public-key authentication:
62+
63+
### Multi-factor authentication
64+
65+
Establish a SFTP connection using both password and public-key authentication:
6366

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

7477
```
7578

79+
### Verify host identify
80+
81+
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:
82+
83+
```cs
84+
byte[] expectedFingerPrint = new byte[] {
85+
0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
86+
0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
87+
};
88+
89+
using (var client = new SshClient("sftp.foo.com", "guest", "pwd"))
90+
{
91+
client.HostKeyReceived += (sender, e) =>
92+
{
93+
if (expectedFingerPrint.Length == e.FingerPrint.Length)
94+
{
95+
for (var i = 0; i < expectedFingerPrint.Length; i++)
96+
{
97+
if (expectedFingerPrint[i] != e.FingerPrint[i])
98+
{
99+
e.CanTrust = false;
100+
break;
101+
}
102+
}
103+
}
104+
else
105+
{
106+
e.CanTrust = false;
107+
}
108+
};
109+
client.Connect();
110+
}
111+
```
112+
76113
## Building SSH.NET
77114

78115
Software | net35 | net40 | netstandard1.3 | sl4 | sl5 | wp71 | wp8 | uap10.0 |

build/nuget/SSH.NET.nuspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>SSH.NET</id>
5-
<version>2016.1.0-beta2</version>
5+
<version>2016.1.0-beta3</version>
66
<title>SSH.NET</title>
77
<authors>Renci</authors>
88
<owners>olegkap,drieseng</owners>
99
<licenseUrl>https://github.com/sshnet/SSH.NET/blob/master/LICENSE</licenseUrl>
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>
13-
<releaseNotes>https://github.com/sshnet/SSH.NET/releases/tag/2016.1.0-beta2</releaseNotes>
13+
<releaseNotes>https://github.com/sshnet/SSH.NET/releases/tag/2016.1.0-beta3</releaseNotes>
1414
<summary>A Secure Shell (SSH) library for .NET, optimized for parallelism.</summary>
1515
<copyright>2012-2017, RENCI</copyright>
1616
<language>en-US</language>

src/Renci.SshNet.NET35/Common/Extensions.NET35.cs

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,15 @@
11
using System;
22
using System.Diagnostics;
3-
using System.Net.Sockets;
43
using System.Security.Cryptography;
54
using System.Text;
6-
using System.Threading;
75

8-
namespace Renci.SshNet
6+
namespace Renci.SshNet.Common
97
{
108
/// <summary>
119
/// Collection of different extension method specific for .NET 3.5
1210
/// </summary>
1311
internal static partial class Extensions
1412
{
15-
/// <summary>
16-
/// Disposes the specified socket.
17-
/// </summary>
18-
/// <param name="socket">The socket.</param>
19-
[DebuggerNonUserCode]
20-
internal static void Dispose(this Socket socket)
21-
{
22-
if (socket == null)
23-
throw new NullReferenceException();
24-
25-
socket.Close();
26-
}
27-
28-
/// <summary>
29-
/// Disposes the specified handle.
30-
/// </summary>
31-
/// <param name="handle">The handle.</param>
32-
[DebuggerNonUserCode]
33-
internal static void Dispose(this WaitHandle handle)
34-
{
35-
if (handle == null)
36-
throw new NullReferenceException();
37-
38-
handle.Close();
39-
}
40-
4113
/// <summary>
4214
/// Disposes the specified algorithm.
4315
/// </summary>

src/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj

+19-1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@
197197
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
198198
<Link>Common\PortForwardEventArgs.cs</Link>
199199
</Compile>
200+
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
201+
<Link>Common\PosixPath.cs</Link>
202+
</Compile>
200203
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
201204
<Link>Common\ProxyException.cs</Link>
202205
</Compile>
@@ -305,6 +308,9 @@
305308
<Compile Include="..\Renci.SshNet\IForwardedPort.cs">
306309
<Link>IForwardedPort.cs</Link>
307310
</Compile>
311+
<Compile Include="..\Renci.SshNet\IRemotePathTransformation.cs">
312+
<Link>IRemotePathTransformation.cs</Link>
313+
</Compile>
308314
<Compile Include="..\Renci.SshNet\IServiceFactory.cs">
309315
<Link>IServiceFactory.cs</Link>
310316
</Compile>
@@ -575,6 +581,18 @@
575581
<Compile Include="..\Renci.SshNet\ProxyTypes.cs">
576582
<Link>ProxyTypes.cs</Link>
577583
</Compile>
584+
<Compile Include="..\Renci.SshNet\RemotePathDoubleQuoteTransformation.cs">
585+
<Link>RemotePathDoubleQuoteTransformation.cs</Link>
586+
</Compile>
587+
<Compile Include="..\Renci.SshNet\RemotePathNoneTransformation.cs">
588+
<Link>RemotePathNoneTransformation.cs</Link>
589+
</Compile>
590+
<Compile Include="..\Renci.SshNet\RemotePathShellQuoteTransformation.cs">
591+
<Link>RemotePathShellQuoteTransformation.cs</Link>
592+
</Compile>
593+
<Compile Include="..\Renci.SshNet\RemotePathTransformation.cs">
594+
<Link>RemotePathTransformation.cs</Link>
595+
</Compile>
578596
<Compile Include="..\Renci.SshNet\ScpClient.cs">
579597
<Link>ScpClient.cs</Link>
580598
</Compile>
@@ -953,7 +971,7 @@
953971
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
954972
<ProjectExtensions>
955973
<VisualStudio>
956-
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
974+
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
957975
</VisualStudio>
958976
</ProjectExtensions>
959977
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

src/Renci.SshNet.NETCore/Renci.SshNet.NETCore.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
<Compile Update="..\Renci.SshNet\Sftp\SftpMessageFactory.cs" Link="Sftp\SftpResponseFactory.cs" />
103103
</ItemGroup>
104104
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
105-
<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>
105+
<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>
106106
</PropertyGroup>
107107
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
108108
<DebugType>portable</DebugType>

src/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj

+20-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<DebugType>full</DebugType>
3030
<Optimize>false</Optimize>
3131
<OutputPath>Bin\Debug</OutputPath>
32-
<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>
32+
<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>
3333
<NoStdLib>true</NoStdLib>
3434
<NoConfig>true</NoConfig>
3535
<ErrorReport>prompt</ErrorReport>
@@ -40,7 +40,7 @@
4040
<DebugType>none</DebugType>
4141
<Optimize>true</Optimize>
4242
<OutputPath>Bin\Release</OutputPath>
43-
<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>
43+
<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>
4444
<NoStdLib>true</NoStdLib>
4545
<NoConfig>true</NoConfig>
4646
<ErrorReport>prompt</ErrorReport>
@@ -209,6 +209,9 @@
209209
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
210210
<Link>Common\PortForwardEventArgs.cs</Link>
211211
</Compile>
212+
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
213+
<Link>Common\PosixPath.cs</Link>
214+
</Compile>
212215
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
213216
<Link>Common\ProxyException.cs</Link>
214217
</Compile>
@@ -311,6 +314,9 @@
311314
<Compile Include="..\Renci.SshNet\IForwardedPort.cs">
312315
<Link>IForwardedPort.cs</Link>
313316
</Compile>
317+
<Compile Include="..\Renci.SshNet\IRemotePathTransformation.cs">
318+
<Link>IRemotePathTransformation.cs</Link>
319+
</Compile>
314320
<Compile Include="..\Renci.SshNet\IServiceFactory.cs">
315321
<Link>IServiceFactory.cs</Link>
316322
</Compile>
@@ -569,6 +575,18 @@
569575
<Compile Include="..\Renci.SshNet\ProxyTypes.cs">
570576
<Link>ProxyTypes.cs</Link>
571577
</Compile>
578+
<Compile Include="..\Renci.SshNet\RemotePathDoubleQuoteTransformation.cs">
579+
<Link>RemotePathDoubleQuoteTransformation.cs</Link>
580+
</Compile>
581+
<Compile Include="..\Renci.SshNet\RemotePathNoneTransformation.cs">
582+
<Link>RemotePathNoneTransformation.cs</Link>
583+
</Compile>
584+
<Compile Include="..\Renci.SshNet\RemotePathShellQuoteTransformation.cs">
585+
<Link>RemotePathShellQuoteTransformation.cs</Link>
586+
</Compile>
587+
<Compile Include="..\Renci.SshNet\RemotePathTransformation.cs">
588+
<Link>RemotePathTransformation.cs</Link>
589+
</Compile>
572590
<Compile Include="..\Renci.SshNet\ScpClient.cs">
573591
<Link>ScpClient.cs</Link>
574592
</Compile>

src/Renci.SshNet.Silverlight5/Renci.SshNet.Silverlight5.csproj

+20-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<DebugType>full</DebugType>
3030
<Optimize>false</Optimize>
3131
<OutputPath>Bin\Debug</OutputPath>
32-
<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>
32+
<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>
3333
<NoStdLib>true</NoStdLib>
3434
<NoConfig>true</NoConfig>
3535
<ErrorReport>prompt</ErrorReport>
@@ -42,7 +42,7 @@
4242
<DebugType>none</DebugType>
4343
<Optimize>true</Optimize>
4444
<OutputPath>Bin\Release</OutputPath>
45-
<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>
45+
<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>
4646
<NoStdLib>true</NoStdLib>
4747
<NoConfig>true</NoConfig>
4848
<ErrorReport>prompt</ErrorReport>
@@ -218,6 +218,9 @@
218218
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
219219
<Link>Common\PortForwardEventArgs.cs</Link>
220220
</Compile>
221+
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
222+
<Link>Common\PosixPath.cs</Link>
223+
</Compile>
221224
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
222225
<Link>Common\ProxyException.cs</Link>
223226
</Compile>
@@ -320,6 +323,9 @@
320323
<Compile Include="..\Renci.SshNet\IForwardedPort.cs">
321324
<Link>IForwardedPort.cs</Link>
322325
</Compile>
326+
<Compile Include="..\Renci.SshNet\IRemotePathTransformation.cs">
327+
<Link>IRemotePathTransformation.cs</Link>
328+
</Compile>
323329
<Compile Include="..\Renci.SshNet\IServiceFactory.cs">
324330
<Link>IServiceFactory.cs</Link>
325331
</Compile>
@@ -578,6 +584,18 @@
578584
<Compile Include="..\Renci.SshNet\ProxyTypes.cs">
579585
<Link>ProxyTypes.cs</Link>
580586
</Compile>
587+
<Compile Include="..\Renci.SshNet\RemotePathDoubleQuoteTransformation.cs">
588+
<Link>RemotePathDoubleQuoteTransformation.cs</Link>
589+
</Compile>
590+
<Compile Include="..\Renci.SshNet\RemotePathNoneTransformation.cs">
591+
<Link>RemotePathNoneTransformation.cs</Link>
592+
</Compile>
593+
<Compile Include="..\Renci.SshNet\RemotePathShellQuoteTransformation.cs">
594+
<Link>RemotePathShellQuoteTransformation.cs</Link>
595+
</Compile>
596+
<Compile Include="..\Renci.SshNet\RemotePathTransformation.cs">
597+
<Link>RemotePathTransformation.cs</Link>
598+
</Compile>
581599
<Compile Include="..\Renci.SshNet\ScpClient.cs">
582600
<Link>ScpClient.cs</Link>
583601
</Compile>

0 commit comments

Comments
 (0)