最近我们感动的是从Windows 2003到Windows Server 2012是否与Tamir.SharpSSH Windows Server 2012兼容?
使用Tamir.SharpSSH在测试我们的应用程序的SFTP功能,我们收到此错误的应用程序:
{“Session.connect:系统.NullReferenceException:未将对象引用设置为对象的实例。\ r \ n在Tamir.SharpSsh.jsch.jce.HMACMD5.update(Byte [] foo,Int32 s,Int32 l)\ r \ n at Tamir.SharpSsh .jsch.jce.HMACMD5.update(Int32 i)\ r \ n at Tamir.SharpSsh.jsch.Session.read(Buffer buf)\ r \ n at Tamir.SharpSsh.jsch.UserAuth.start(Session session)\ r \ n在Tamir.SharpSsh.jsch.UserAuthNone.start(会话会话)\ r \ n在Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)“}
我检查以确保符合FIPS标准的算法被禁用,并且它们是。
然后,我们从项目中移除了对Tamir.SharpSSH的DLL引用,并将源代码项目添加到了我们现在可以进入代码的位置,以更具体地确定SharpSSH库中发生故障的位置。
误差以cs.Write(FOO,S,L)在更新()方法存在的,如下所示:
public void update(byte[] foo, int s, int l) { cs.Write(foo, s, l); }
这是因为CS对象引用是NULL。
cs对象引用应该在HMACMD5.cs(最后一行)的init()方法中设置,但是不会显示此方法正在调用。
public void init(byte[] key)
{
if(key.Length>bsize)
{
byte[] tmp=new byte[bsize];
Array.Copy(key, 0, tmp, 0, bsize);
key=tmp;
}
// SecretKeySpec skey=new SecretKeySpec(key, "HmacMD5");
// mac=Mac.getInstance("HmacMD5");
// mac.init(skey);
mentalis_mac = new Org.Mentalis.Security.Cryptography.HMAC(new System.Security.Cryptography.MD5CryptoServiceProvider(), key);
cs = new System.Security.Cryptography.CryptoStream(System.IO.Stream.Null, mentalis_mac, System.Security.Cryptography.CryptoStreamMode.Write);
}
我不确定为什么init()方法没有被调用。
有没有人遇到类似这样的事情?
我想知道它是否可能是Windows Server 2012兼容性问题。
在此先感谢。