|  | @@ -14,32 +14,32 @@ namespace Renci.SshNet.Common
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          private const byte BOOLEAN = 0x01;
 | 
	
		
			
				|  |  |          private const byte INTEGER = 0x02;
 | 
	
		
			
				|  |  | -        private const byte BITSTRING = 0x03;
 | 
	
		
			
				|  |  | +        //private const byte BITSTRING = 0x03;
 | 
	
		
			
				|  |  |          private const byte OCTETSTRING = 0x04;
 | 
	
		
			
				|  |  |          private const byte NULL = 0x05;
 | 
	
		
			
				|  |  |          private const byte OBJECTIDENTIFIER = 0x06;
 | 
	
		
			
				|  |  | -        private const byte EXTERNAL = 0x08;
 | 
	
		
			
				|  |  | -        private const byte ENUMERATED = 0x0a;
 | 
	
		
			
				|  |  | +        //private const byte EXTERNAL = 0x08;
 | 
	
		
			
				|  |  | +        //private const byte ENUMERATED = 0x0a;
 | 
	
		
			
				|  |  |          private const byte SEQUENCE = 0x10;
 | 
	
		
			
				|  |  | -        private const byte SEQUENCEOF = 0x10; // for completeness
 | 
	
		
			
				|  |  | -        private const byte SET = 0x11;
 | 
	
		
			
				|  |  | -        private const byte SETOF = 0x11; // for completeness
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        private const byte NUMERICSTRING = 0x12;
 | 
	
		
			
				|  |  | -        private const byte PRINTABLESTRING = 0x13;
 | 
	
		
			
				|  |  | -        private const byte T61STRING = 0x14;
 | 
	
		
			
				|  |  | -        private const byte VIDEOTEXSTRING = 0x15;
 | 
	
		
			
				|  |  | -        private const byte IA5STRING = 0x16;
 | 
	
		
			
				|  |  | -        private const byte UTCTIME = 0x17;
 | 
	
		
			
				|  |  | -        private const byte GENERALIZEDTIME = 0x18;
 | 
	
		
			
				|  |  | -        private const byte GRAPHICSTRING = 0x19;
 | 
	
		
			
				|  |  | -        private const byte VISIBLESTRING = 0x1a;
 | 
	
		
			
				|  |  | -        private const byte GENERALSTRING = 0x1b;
 | 
	
		
			
				|  |  | -        private const byte UNIVERSALSTRING = 0x1c;
 | 
	
		
			
				|  |  | -        private const byte BMPSTRING = 0x1e;
 | 
	
		
			
				|  |  | -        private const byte UTF8STRING = 0x0c;
 | 
	
		
			
				|  |  | -        private const byte APPLICATION = 0x40;
 | 
	
		
			
				|  |  | -        private const byte TAGGED = 0x80;
 | 
	
		
			
				|  |  | +        //private const byte SEQUENCEOF = 0x10; // for completeness
 | 
	
		
			
				|  |  | +        //private const byte SET = 0x11;
 | 
	
		
			
				|  |  | +        //private const byte SETOF = 0x11; // for completeness
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //private const byte NUMERICSTRING = 0x12;
 | 
	
		
			
				|  |  | +        //private const byte PRINTABLESTRING = 0x13;
 | 
	
		
			
				|  |  | +        //private const byte T61STRING = 0x14;
 | 
	
		
			
				|  |  | +        //private const byte VIDEOTEXSTRING = 0x15;
 | 
	
		
			
				|  |  | +        //private const byte IA5STRING = 0x16;
 | 
	
		
			
				|  |  | +        //private const byte UTCTIME = 0x17;
 | 
	
		
			
				|  |  | +        //private const byte GENERALIZEDTIME = 0x18;
 | 
	
		
			
				|  |  | +        //private const byte GRAPHICSTRING = 0x19;
 | 
	
		
			
				|  |  | +        //private const byte VISIBLESTRING = 0x1a;
 | 
	
		
			
				|  |  | +        //private const byte GENERALSTRING = 0x1b;
 | 
	
		
			
				|  |  | +        //private const byte UNIVERSALSTRING = 0x1c;
 | 
	
		
			
				|  |  | +        //private const byte BMPSTRING = 0x1e;
 | 
	
		
			
				|  |  | +        //private const byte UTF8STRING = 0x0c;
 | 
	
		
			
				|  |  | +        //private const byte APPLICATION = 0x40;
 | 
	
		
			
				|  |  | +        //private const byte TAGGED = 0x80;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          private List<byte> _data;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -142,6 +142,17 @@ namespace Renci.SshNet.Common
 | 
	
		
			
				|  |  |              return result;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// Writes BOOLEAN data into internal buffer.
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        /// <param name="data">UInt32 data to write.</param>
 | 
	
		
			
				|  |  | +        public void Write(bool data)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            this._data.Add(BOOLEAN);
 | 
	
		
			
				|  |  | +            this._data.Add(1);
 | 
	
		
			
				|  |  | +            this._data.Add((byte)(data ? 1 : 0));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          /// <summary>
 | 
	
		
			
				|  |  |          /// Writes UInt32 data into internal buffer.
 | 
	
		
			
				|  |  |          /// </summary>
 | 
	
	
		
			
				|  | @@ -156,7 +167,7 @@ namespace Renci.SshNet.Common
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          /// <summary>
 | 
	
		
			
				|  |  | -        /// Writes BigInteger data into internal buffer.
 | 
	
		
			
				|  |  | +        /// Writes INTEGER data into internal buffer.
 | 
	
		
			
				|  |  |          /// </summary>
 | 
	
		
			
				|  |  |          /// <param name="data">BigInteger data to write.</param>
 | 
	
		
			
				|  |  |          public void Write(BigInteger data)
 | 
	
	
		
			
				|  | @@ -168,13 +179,79 @@ namespace Renci.SshNet.Common
 | 
	
		
			
				|  |  |              this.WriteBytes(bytes);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// Writes OCTETSTRING data into internal buffer.
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        /// <param name="data">The data.</param>
 | 
	
		
			
				|  |  | +        public void Write(byte[] data)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            this._data.Add(OCTETSTRING);
 | 
	
		
			
				|  |  | +            var length = this.GetLength(data.Length);
 | 
	
		
			
				|  |  | +            this.WriteBytes(length);
 | 
	
		
			
				|  |  | +            this.WriteBytes(data);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// Writes OBJECTIDENTIFIER data into internal buffer.
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        /// <param name="identifiers">The identifiers.</param>
 | 
	
		
			
				|  |  | +        public void Write(ObjectIdentifier identifier)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            var temp = new ulong[identifier.Identifiers.Length - 1];
 | 
	
		
			
				|  |  | +            temp[0] = identifier.Identifiers[0] * 40 + identifier.Identifiers[1];
 | 
	
		
			
				|  |  | +            Array.Copy(identifier.Identifiers, 2, temp, 1, identifier.Identifiers.Length - 2);
 | 
	
		
			
				|  |  | +            var bytes = new List<byte>();
 | 
	
		
			
				|  |  | +            foreach (var subidentifier in temp)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                var item = subidentifier;
 | 
	
		
			
				|  |  | +                var buffer = new byte[8];
 | 
	
		
			
				|  |  | +                var bufferIndex = buffer.Length - 1;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                var current = (byte)(item & 0x7F);
 | 
	
		
			
				|  |  | +                do
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    buffer[bufferIndex] = current;
 | 
	
		
			
				|  |  | +                    if (bufferIndex < buffer.Length - 1)
 | 
	
		
			
				|  |  | +                        buffer[bufferIndex] |= (byte)0x80;
 | 
	
		
			
				|  |  | +                    item >>= 7;
 | 
	
		
			
				|  |  | +                    current = (byte)(item & 0x7F);
 | 
	
		
			
				|  |  | +                    bufferIndex--;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                while (current > 0);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                for (int i = bufferIndex + 1; i < buffer.Length; i++)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    bytes.Add(buffer[i]);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            this._data.Add(OBJECTIDENTIFIER);
 | 
	
		
			
				|  |  | +            var length = this.GetLength(bytes.Count);
 | 
	
		
			
				|  |  | +            this.WriteBytes(length);
 | 
	
		
			
				|  |  | +            this.WriteBytes(bytes);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// Writes NULL data into internal buffer.
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        public void WriteNull()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            this._data.Add(NULL);
 | 
	
		
			
				|  |  | +            this._data.Add(0);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          /// <summary>
 | 
	
		
			
				|  |  |          /// Writes DerData data into internal buffer.
 | 
	
		
			
				|  |  |          /// </summary>
 | 
	
		
			
				|  |  |          /// <param name="data">DerData data to write.</param>
 | 
	
		
			
				|  |  |          public void Write(DerData data)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            throw new NotImplementedException();
 | 
	
		
			
				|  |  | +            var bytes = data.Encode();
 | 
	
		
			
				|  |  | +            this._data.AddRange(bytes);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          private byte[] GetLength(int length)
 |