コード例 #1
0
        /// <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);
        }
コード例 #2
0
ファイル: Session.cs プロジェクト: yayanyang/monodevelop
		/// <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");
		}
コード例 #3
0
 protected override void Configure(OpenSshConfig.Host hc, NSch.Session session)
 {
 }
コード例 #4
0
ファイル: Channel.cs プロジェクト: LunarLanding/ngit
			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];
			}
コード例 #5
0
ファイル: Channel.cs プロジェクト: LunarLanding/ngit
		internal static void Del(NSch.Channel c)
		{
			lock (pool)
			{
				pool.RemoveElement(c);
			}
		}
コード例 #6
0
		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);
			}
		}