Skip to content

Commit

Permalink
Enable Build of Elliptic-Curves for other Projects
Browse files Browse the repository at this point in the history
  • Loading branch information
darinkes committed Dec 4, 2018
1 parent f513a96 commit cb2a922
Show file tree
Hide file tree
Showing 20 changed files with 3,371 additions and 40 deletions.
822 changes: 822 additions & 0 deletions src/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/Renci.SshNet.NETCore/Renci.SshNet.NETCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<PackageReference Include="SshNet.Security.Cryptography" Version="[1.3.0]" />
</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_SOCKET_DISPOSE;FEATURE_DNS_TAP;FEATURE_STREAM_TAP;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_TAP;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>
<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_TAP;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;PORTABLE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>FEATURE_ENCODING_ASCII;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_MEMORYSTREAM_TRYGETBUFFER;FEATURE_RNG_CREATE;FEATURE_SOCKET_TAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_SELECT;FEATURE_SOCKET_POLL;FEATURE_SOCKET_DISPOSE;FEATURE_DNS_SYNC;FEATURE_DNS_APM;FEATURE_DNS_TAP;FEATURE_STREAM_APM;FEATURE_STREAM_TAP;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_TAP;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>
<DefineConstants>FEATURE_ENCODING_ASCII;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_MEMORYSTREAM_TRYGETBUFFER;FEATURE_RNG_CREATE;FEATURE_SOCKET_TAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_SELECT;FEATURE_SOCKET_POLL;FEATURE_SOCKET_DISPOSE;FEATURE_DNS_SYNC;FEATURE_DNS_APM;FEATURE_DNS_TAP;FEATURE_STREAM_APM;FEATURE_STREAM_TAP;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_TAP;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;PORTABLE</DefineConstants>
</PropertyGroup>
</Project>
</Project>
831 changes: 828 additions & 3 deletions src/Renci.SshNet.Silverlight5/Renci.SshNet.Silverlight5.csproj

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/Renci.SshNet.Tests.NET35/Renci.SshNet.Tests.NET35.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,12 @@
<EmbeddedResource Include="..\Renci.SshNet.Tests\Data\Key.ECDSA521.Encrypted.txt">
<Link>Data\Key.ECDSA521.Encrypted.txt</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\Renci.SshNet.Tests\Data\Key.OPENSSH.ED25519.Encrypted.txt">
<Link>Data\Key.OPENSSH.ED25519.Encrypted.txt</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\Renci.SshNet.Tests\Data\Key.OPENSSH.ED25519.txt">
<Link>Data\Key.OPENSSH.ED25519.txt</Link>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
Expand All @@ -1770,4 +1776,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
849 changes: 840 additions & 9 deletions src/Renci.SshNet.UAP10/Renci.SshNet.UAP10.csproj

Large diffs are not rendered by default.

845 changes: 838 additions & 7 deletions src/Renci.SshNet.WindowsPhone8/Renci.SshNet.WindowsPhone8.csproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Renci.SshNet.Security.Org.BouncyCastle.Asn1
{
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class Asn1Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Renci.SshNet.Security.Org.BouncyCastle.Asn1
{
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class Asn1ParsingException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#if !(NETCF_1_0 || PORTABLE)

using System;
using System.Security.Cryptography;

Expand All @@ -14,7 +12,11 @@ internal class CryptoApiRandomGenerator
private readonly RandomNumberGenerator rndProv;

public CryptoApiRandomGenerator()
#if SILVERLIGHT5 || WINDOWS_PHONE8
: this(new RNGCryptoServiceProvider())
#else
: this(RandomNumberGenerator.Create())
#endif
{
}

Expand All @@ -23,7 +25,7 @@ public CryptoApiRandomGenerator(RandomNumberGenerator rng)
this.rndProv = rng;
}

#region IRandomGenerator Members
#region IRandomGenerator Members

public virtual void AddSeedMaterial(byte[] seed)
{
Expand Down Expand Up @@ -59,8 +61,6 @@ public virtual void NextBytes(byte[] bytes, int start, int len)
}
}

#endregion
#endregion
}
}

#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Renci.SshNet.Security.Org.BouncyCastle.Math
{
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class BigInteger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Renci.SshNet.Security.Org.BouncyCastle.Security
{
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class GeneralSecurityException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Renci.SshNet.Security.Org.BouncyCastle.Security
{
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class InvalidKeyException : KeyException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Renci.SshNet.Security.Org.BouncyCastle.Security
{
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class InvalidParameterException : KeyException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Renci.SshNet.Security.Org.BouncyCastle.Security
{
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class KeyException : GeneralSecurityException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Renci.SshNet.Security.Org.BouncyCastle.Security
{
[Obsolete("Never thrown")]
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class NoSuchAlgorithmException : GeneralSecurityException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Renci.SshNet.Security.Org.BouncyCastle.Security
{
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class SecurityUtilityException
Expand Down
4 changes: 4 additions & 0 deletions src/Renci.SshNet/Security/BouncyCastle/src/util/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ internal static Enum GetArbitraryValue(System.Type enumType)

internal static bool IsEnumType(System.Type t)
{
#if PORTABLE
return true;
#else
return t.IsEnum;
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ public static bool CheckElementsAreOfType(IEnumerable e, Type t)
{
foreach (object o in e)
{
#if PORTABLE
return true;
#else
if (!t.IsInstanceOfType(o))
return false;
#endif
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Renci.SshNet.Security.Org.BouncyCastle.Utilities.IO
{
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE)
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
internal class StreamOverflowException
Expand Down
8 changes: 8 additions & 0 deletions src/Renci.SshNet/Security/Cryptography/Bcrypt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,18 @@ public static string HashPassword(string input, string salt)
public static string GenerateSalt(int workFactor)
{
if (workFactor < 4 || workFactor > 31)
#if SILVERLIGHT5
throw new ArgumentOutOfRangeException("workFactor", "The work factor must be between 4 and 31 (inclusive)");
#else
throw new ArgumentOutOfRangeException("workFactor", workFactor, "The work factor must be between 4 and 31 (inclusive)");
#endif

byte[] rnd = new byte[BCRYPT_SALT_LEN];
#if SILVERLIGHT5 || WINDOWS_PHONE8
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
#else
RandomNumberGenerator rng = RandomNumberGenerator.Create();
#endif
rng.GetBytes(rnd);

StringBuilder rs = new StringBuilder();
Expand Down

0 comments on commit cb2a922

Please sign in to comment.