/// <summary> /// 設定 /// </summary> /// <param name="hc">ホスト</param> /// <param name="session">セッション</param> protected override void Configure(NGit.Transport.OpenSshConfig.Host hc, NSch.Session session) { var config = new Properties(); config["StrictHostKeyChecking"] = "no"; config["PreferredAuthentications"] = "publickey"; session.SetConfig(config); var jsch = this.GetJSch(hc, FS.DETECTED); jsch.AddIdentity("KeyPair", Encoding.UTF8.GetBytes(PrivateKey), Encoding.UTF8.GetBytes(PublicKey), null); }
/// <exception cref="NSch.JSchException"></exception> /// <exception cref="System.IO.IOException"></exception> private void Start_discard(Buffer buf, NSch.Cipher cipher, MAC mac, int packet_length , int discard) { MAC discard_mac = null; if (!cipher.IsCBC()) { throw new JSchException("Packet corrupt"); } if (packet_length != PACKET_MAX_SIZE && mac != null) { discard_mac = mac; } discard -= buf.index; while (discard > 0) { buf.Reset(); int len = discard > buf.buffer.Length ? buf.buffer.Length : discard; io.GetByte(buf.buffer, 0, len); if (discard_mac != null) { discard_mac.Update(buf.buffer, 0, len); } discard -= len; } if (discard_mac != null) { discard_mac.DoFinal(buf.buffer, 0); } throw new JSchException("Packet corrupt"); }
protected override void Configure(OpenSshConfig.Host hc, NSch.Session session) { }
public _OutputStream_220(Channel _enclosing, NSch.Channel channel) { this._enclosing = _enclosing; this.channel = channel; this.dataLen = 0; this.buffer = null; this.packet = null; this.closed = false; this.b = new byte[1]; }
internal static void Del(NSch.Channel c) { lock (pool) { pool.RemoveElement(c); } }
internal static void DelPort(NSch.ChannelForwardedTCPIP c) { Session _session = null; try { _session = c.GetSession(); } catch (JSchException) { } // session has been already down. if (_session != null) { DelPort(_session, c.rport); } }