This project has moved. For the latest updates, please go here.

Unable write file to /home2/Sample.txt. Method not found: 'Void Tamir.SharpSsh.SshBase.ConnectThroughProxy(Int32, System.String, Int32, System.String, System.String)'.

Apr 29, 2014 at 6:58 PM
Hi All
I am getting the following error in the application log when I am trying to transfer a file to a SFTP location:

Method: Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessage
Error: [SftpTransmitterEndpoint] Unable to transmit file /home2/Sample.txt.
Inner Exception:
Unable write file to /home2/Sample.txt
Method not found: 'Void Tamir.SharpSsh.SshBase.ConnectThroughProxy(Int32, System.String, Int32, System.String, System.String)'.. Changing any Send Port Transport properties might require the host to be restarted, as the connection pool might still have connections

Please let me know if anyone has a solution.
Apr 29, 2014 at 9:28 PM
First look, it seems you might have the wrong version of the ssh library. How did you install the adapter, using msi our custom? What version of the adapter are using? Did you update the adapter from an earlier version?


Sent from my Windows Phone

Apr 30, 2014 at 4:41 AM
Hi Mikael
Thanks for your reply.
I am using v1.5 of the adapter. I installed the adapter using a MSI and upgraded it from v1.4.

Apr 30, 2014 at 11:58 AM
Hi All
The error mentioned above was because I was using an older version of the SSH library.
Thank you Mikael for your insight.

The actual issue, that we were facing was that whenever we were trying to send a file to a SFTP location we were getting the following error.:

Type: Tamir.SharpSsh.jsch.JSchException
Target: Void connect(Int32)
Message: Session.connect: System.Security.Cryptography.CryptographicException: Bad Data.

at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
at System.Security.Cryptography.Utils._ImportKey(SafeProvHandle hCSP, Int32 keyNumber, CspProviderFlags flags, Object cspObject, SafeKeyHandle& hKey)
at System.Security.Cryptography.DSACryptoServiceProvider.ImportParameters(DSAParameters parameters)
at Tamir.SharpSsh.jsch.jce.SignatureDSA.verify(Byte[] sig)
at _buf)
at Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)
at Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)
at Tamir.SharpSsh.SshBase.ConnectSession(Int32 tcpPort)
at Tamir.SharpSsh.SshBase.Connect(Int32 tcpPort)
at Blogical.Shared.Adapters.Sftp.SharpSsh.Sftp.connect(Boolean force)

in order to fix this issue we tried all sorts of things and that is what lead us to the "Method not found: 'Void Tamir.SharpSsh.SshBase.ConnectThroughProxy" error.

Possible reason for "cryptographicException: Bad Data error:" SharpSSH library only supports DSS with up to 1024-bit keys and if you connect to a server that uses a >1024 DSS key, you get the Bad Data exception in ImportParameters.

Now, this is how we fixed the cryptographicException: Bad Data error:

We, downloaded the latest source code of the blogical sftp adapter from codeplex. Built that code and changed the following function in SharpSSH\jsch\jce\SignatureDSA.cs:

public bool verify(byte[] sig)

        BigInteger r, s, w, gu1p, yu2p, gu1yu2p, u1, u2, sha, v;

        BigInteger P = new BigInteger(DSAKeyInfo.P);
        BigInteger Q = new BigInteger(DSAKeyInfo.Q);
        BigInteger G = new BigInteger(DSAKeyInfo.G);
        BigInteger Y = new BigInteger(DSAKeyInfo.Y);
        long i = 0;

        if (sig.Length != 40)
            int n = (int)((sig[i++] << 24) & 0xff000000) | ((sig[i++] << 16) & 0x00ff0000) |
                ((sig[i++] << 8) & 0x0000ff00) | ((sig[i++]) & 0x000000ff);

            if (n != 7 || Util.getString(sig, (int)i, 7) != "ssh-dss")
                throw new System.Security.Cryptography.CryptographicException("Bad Data!\r\n");

            i += 7;

            n = (int)((sig[i++] << 24) & 0xff000000) | ((sig[i++] << 16) & 0x00ff0000) |
                ((sig[i++] << 8) & 0x0000ff00) | ((sig[i++]) & 0x000000ff);

            if (n != 40 || i + 40 > sig.Length)
                throw new System.Security.Cryptography.CryptographicException("Bad Data!\r\n");

            byte[] tmp = new byte[20];
            Array.Copy(sig, i, tmp, 0, 20);

            r = new BigInteger(tmp);

            tmp = new byte[20];
            Array.Copy(sig, i + 20, tmp, 0, 20);

            s = new BigInteger(tmp);

            w = modinv(s, Q);

         if (sha1.Hash.Length != 20)
            throw new System.Security.Cryptography.CryptographicException("Bad Data!\r\n");

        sha = new BigInteger(sha1.Hash);

        u1 = modmul(sha, w, Q);

        u2 = modmul(r, w, Q);

        gu1p = modpow(G, u1, P);
        yu2p = modpow(Y, u2, P);
        gu1yu2p = modmul(gu1p, yu2p, P);
        v = BigInteger.Modulus(gu1yu2p, Q);//v = modmul(gu1yu2p, One, Q);

                return bignum_cmp(v, r) == 0;

    private BigInteger modinv(BigInteger a, BigInteger b) { return a.ModInverse(b); }
    private BigInteger modmul(BigInteger a, BigInteger b, BigInteger n) { return BigInteger.Modulus(a * b, n); }
    private BigInteger modpow(BigInteger a, BigInteger exp, BigInteger n) { return a.ModPow(exp, n); }
    private BigInteger.Sign bignum_cmp(BigInteger a, BigInteger b) { return a.Compare(b); }
    private BigInteger bigmod(BigInteger a, BigInteger b)
        return BigInteger.Modulus(a, b);
along with this, we also added a class to support BigInteger.

Marked as answer by shivipratapsingh on 4/30/2014 at 6:32 AM