From 19802b6553cfab4809b95d678f562b46e23641ec Mon Sep 17 00:00:00 2001 From: olegkap_cp Date: Thu, 31 Jan 2013 04:45:14 +0000 Subject: [PATCH] Add IPAddress as parameter to ForwardedPortRemote Allow all projects to generate xml documentation files Add GetIPAddress method and other minor refactoring --- .../Common/Extensions.NET35.cs | 24 -- .../Renci.SshNet.NET35.csproj | 16 + .../Common/Extensions.SilverlightShared.cs | 10 + .../Renci.SshNet.Silverlight.csproj | 12 +- .../Renci.SshNet.Silverlight5.csproj | 10 + .../Classes/ForwardedPortRemoteTest.cs | 2 +- .../Properties/Resources.Designer.cs | 4 +- .../Properties/Resources.resx | 2 +- .../Renci.SshNet.WindowsPhone.csproj | 12 +- .../Renci.SshNet.WindowsPhone8.csproj | 12 +- Renci.SshClient/Renci.SshNet.sln | 16 + .../Channels/ChannelForwardedTcpip.NET40.cs | 4 +- .../Channels/ChannelForwardedTcpip.cs | 4 +- .../Renci.SshNet/Common/Extensions.NET.cs | 48 +++ .../Renci.SshNet/ForwardedPortDynamic.NET.cs | 3 +- .../Renci.SshNet/ForwardedPortLocal.NET.cs | 5 +- .../Renci.SshNet/ForwardedPortRemote.NET.cs | 37 +++ .../Renci.SshNet/ForwardedPortRemote.cs | 68 +++-- .../Transport/KeyExchangeEcdhInitMessage.cs | 50 +++ .../Transport/KeyExchangeEcdhReplyMessage.cs | 50 +++ .../Renci.SshNet/Renci.SshNet.csproj | 8 +- .../KeyExchangeEllipticCurveDiffieHellman.cs | 284 ++++++++++++++++++ Renci.SshClient/Renci.SshNet/Session.NET.cs | 4 +- Renci.SshClient/Renci.SshNet/Session.cs | 22 +- 24 files changed, 608 insertions(+), 99 deletions(-) create mode 100644 Renci.SshClient/Renci.SshNet/Common/Extensions.NET.cs create mode 100644 Renci.SshClient/Renci.SshNet/ForwardedPortRemote.NET.cs create mode 100644 Renci.SshClient/Renci.SshNet/Messages/Transport/KeyExchangeEcdhInitMessage.cs create mode 100644 Renci.SshClient/Renci.SshNet/Messages/Transport/KeyExchangeEcdhReplyMessage.cs create mode 100644 Renci.SshClient/Renci.SshNet/Security/KeyExchangeEllipticCurveDiffieHellman.cs diff --git a/Renci.SshClient/Renci.SshNet.NET35/Common/Extensions.NET35.cs b/Renci.SshClient/Renci.SshNet.NET35/Common/Extensions.NET35.cs index 847931cc..3fd71b0d 100644 --- a/Renci.SshClient/Renci.SshNet.NET35/Common/Extensions.NET35.cs +++ b/Renci.SshClient/Renci.SshNet.NET35/Common/Extensions.NET35.cs @@ -14,20 +14,6 @@ namespace Renci.SshNet /// public static partial class Extensions { - /// - /// Determines whether [is null or white space] [the specified value]. - /// - /// The value. - /// - /// true if [is null or white space] [the specified value]; otherwise, false. - /// - internal static bool IsNullOrWhiteSpace(this string value) - { - if (string.IsNullOrEmpty(value)) return true; - - return value.All(char.IsWhiteSpace); - } - /// /// Disposes the specified socket. /// @@ -78,15 +64,5 @@ namespace Renci.SshNet value.Length = 0; value.Capacity = 16; } - - internal static bool CanRead(this Socket socket) - { - return socket.Connected && socket.Poll(-1, SelectMode.SelectRead) && socket.Available > 0; - } - - internal static bool CanWrite(this Socket socket) - { - return socket.Connected && socket.Poll(-1, SelectMode.SelectWrite); - } } } diff --git a/Renci.SshClient/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj b/Renci.SshClient/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj index 87edc0ac..7ededa08 100644 --- a/Renci.SshClient/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj +++ b/Renci.SshClient/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj @@ -29,6 +29,7 @@ TRACE prompt 4 + bin\Release\Renci.SshNet.XML @@ -117,6 +118,9 @@ Common\Extensions.cs + + Common\Extensions.NET.cs + Common\HostKeyEventArgs.cs @@ -246,6 +250,9 @@ ForwardedPortRemote.cs + + ForwardedPortRemote.NET.cs + HashInfo.cs @@ -450,6 +457,12 @@ Messages\Transport\KeyExchangeDhReplyMessage.cs + + Messages\Transport\KeyExchangeEcdhInitMessage.cs + + + Messages\Transport\KeyExchangeEcdhReplyMessage.cs + Messages\Transport\KeyExchangeInitMessage.cs @@ -639,6 +652,9 @@ Security\KeyExchangeDiffieHellmanGroupSha1.cs + + Security\KeyExchangeEllipticCurveDiffieHellman.cs + Security\KeyHostAlgorithm.cs diff --git a/Renci.SshClient/Renci.SshNet.Silverlight/Common/Extensions.SilverlightShared.cs b/Renci.SshClient/Renci.SshNet.Silverlight/Common/Extensions.SilverlightShared.cs index 43206f5b..d74930e6 100644 --- a/Renci.SshClient/Renci.SshNet.Silverlight/Common/Extensions.SilverlightShared.cs +++ b/Renci.SshClient/Renci.SshNet.Silverlight/Common/Extensions.SilverlightShared.cs @@ -6,6 +6,7 @@ using System.Net.Sockets; using System.Threading; using System.Security.Cryptography; using System.Diagnostics; +using System.Net; namespace Renci.SshNet.Common { @@ -77,5 +78,14 @@ namespace Renci.SshNet.Common return socket.Connected; } + internal static IPAddress GetIPAddress(this string host) + { + IPAddress ipAddress; + if (!IPAddress.TryParse(host, out ipAddress)) + { + throw new ProxyException("Silverlight supports only IP addresses."); + } + return ipAddress; + } } } diff --git a/Renci.SshClient/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj b/Renci.SshClient/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj index 4b3b3c18..b3ae9da4 100644 --- a/Renci.SshClient/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj +++ b/Renci.SshClient/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj @@ -49,6 +49,7 @@ true prompt 4 + Bin\Release\Renci.SshNet.Silverlight.XML @@ -433,6 +434,12 @@ Messages\Transport\KeyExchangeDhReplyMessage.cs + + Messages\Transport\KeyExchangeEcdhInitMessage.cs + + + Messages\Transport\KeyExchangeEcdhReplyMessage.cs + Messages\Transport\KeyExchangeInitMessage.cs @@ -613,6 +620,9 @@ Security\KeyExchangeDiffieHellmanGroupSha1.cs + + Security\KeyExchangeEllipticCurveDiffieHellman.cs + Security\KeyHostAlgorithm.cs @@ -813,7 +823,7 @@ - +