diffie-hellman group exchange sha256 support (wodSSH / wodSSH.NET)
Hi Jasmine,
we have applied the 2.6.4.160 version of SSH.NET in our software. Unfortunately, we have met an issue with loading this library: WeOnlyDo.Security.Cryptography.KeyManager.dll. The older version of this library (from 2.5.0.130) is working fine. We are able the new version of the library by adding useLegacyV2RuntimeActivationPolicy="true" to App.config, but we would like to avoid it.
Our program is compiled against .NET Framework 4.5.
Code to reproduce:
using System;
using WeOnlyDo.Security.Cryptography;
namespace WeOnlyDoKeyManagmentTest
{
class Program
{
// Program does not work,
// it can be fixed by adding useLegacyV2RuntimeActivationPolicy="true" to App.config (ref. http://stackoverflow.com/questions/1604663/what-does-uselegacyv2runtimeactivationpolicy-do-in-the-net-4-config)
// ex: System.IO.FileLoadException
// message: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
static void Main()
{
const string key = @"-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
";
var decrypted = DecryptCertificateFile(key, String.Empty, "RSA");
Console.WriteLine(decrypted);
}
public static string DecryptCertificateFile(string content, string password, string keyType)
{
SSHKeyTypes sshKeyType;
switch (keyType.ToLowerInvariant())
{
case "rsa":
sshKeyType = SSHKeyTypes.RSAKey;
break;
case "dsa":
sshKeyType = SSHKeyTypes.DSAKey;
break;
default:
throw new ArgumentOutOfRangeException(nameof(keyType));
}
try
{
var manager = new KeyManager();
manager.Load(content, password);
return Convert.ToBase64String(manager.PrivateKey(sshKeyType));
}
catch (Exception exception)
{
throw new Exception("Can't load private key.", exception);
}
}
}
}
Could you please provide working version? The best option is to compile you library against .net 4.5 (please remember for FIPS version).
Regards,
Piotr
Complete thread:
- diffie-hellman group exchange sha256 support - Alek, 2016-02-25, 16:20
- diffie-hellman group exchange sha256 support - Jasmine, 2016-02-25, 16:30
- diffie-hellman group exchange sha256 support - Alek, 2016-03-01, 09:34
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-03, 02:44
- diffie-hellman group exchange sha256 support - Alek, 2016-03-04, 11:59
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-04, 12:00
- diffie-hellman group exchange sha256 support - Alek, 2016-03-04, 12:29
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-04, 12:33
- diffie-hellman group exchange sha256 support - david, 2016-03-07, 20:55
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-07, 21:00
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-07, 21:13
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-08, 22:59
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-07, 21:00
- diffie-hellman group exchange sha256 support - Alek, 2016-03-10, 15:38
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-10, 17:13
- diffie-hellman group exchange sha256 support - Piotr, 2016-03-22, 08:41
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-22, 11:39
- diffie-hellman group exchange sha256 support - Jirka, 2016-04-15, 14:44
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-22, 11:39
- diffie-hellman group exchange sha256 support - Piotr, 2016-03-22, 08:41
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-10, 17:13
- diffie-hellman group exchange sha256 support - david, 2016-03-07, 20:55
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-04, 12:33
- diffie-hellman group exchange sha256 support - Alek, 2016-03-04, 12:29
- diffie-hellman group exchange sha256 support - Jasmine, 2016-03-04, 12:00
- diffie-hellman group exchange sha256 support - Alek, 2016-03-04, 11:59
- diffie-hellman group exchange sha256 support - Jasmine, 2016-02-25, 16:30