diffie-hellman group exchange sha256 support - WeOnlyDo Discussion board

diffie-hellman group exchange sha256 support (wodSSH / wodSSH.NET)

by Piotr, Tuesday, March 22, 2016, 08:41 (1472 days ago) @ Jasmine

Hi Jasmine,
we have applied the 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 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-----
            var decrypted = DecryptCertificateFile(key, String.Empty, "RSA");


        public static string DecryptCertificateFile(string content, string password, string keyType)
            SSHKeyTypes sshKeyType;
            switch (keyType.ToLowerInvariant())
                case "rsa":
                    sshKeyType = SSHKeyTypes.RSAKey;
                case "dsa":
                    sshKeyType = SSHKeyTypes.DSAKey;
                    throw new ArgumentOutOfRangeException(nameof(keyType));

                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).


Complete thread: